Downloading from remote repository using artifactory plugin for Jenkins does not work

I have set up a remote, generic repository to point to a public CentOS mirror site and called it centos-remote. I can browse the repository in Artifactory in "Native Browser" and see all files as they're in the original repo. However when I'm trying to download files or folders using plugin for Jenkins I'm not getting any files.

This is the download spec I'm using (folder images in the repo contains few large files):

{"files": [{"pattern": "centos-remote/images/", "target": "images/"}]}

This is what I have in logs:

[2022-01-11T17:32:09.930Z] Searching for artifacts...
[2022-01-11T17:32:13.509Z] Found 0 artifacts.
[2022-01-11T17:32:13.509Z] Beginning to resolve Build Info published dependencies.
[2022-01-11T17:32:13.509Z] Finished resolving Build Info published dependencies.

Plugin itself seems to work fine as downloading from local repositories works without issues.

I added explicit, read-only permissions for the user Jenkins is using to connect to Artifactory, however this did not change anything.

What's more - when creating the remote repository a new automatic repository called centos-remote-cache was created. It looks it contains only files that has previously been downloaded. If I use "Native Browser" and I explicitly download to my disk a file from centos-remote/images/ folder, that file will be visible in centos-remote-cache repo. If I change my download spec to point to centos-remote-cache/images/ that one particular, explicitly downloaded, file will be downloaded properly, but nothing more.

This is not a solution for me as I would like the plugin to reach out not to the cache but to the remote repo and force download of whole folders.

I'm using:

  • Artifactory version 6.17.0
  • Artifactory pluging for Jenkins version 3.10.6
  • Jenkins version 2.277.1

Solution 1:

Unfortunately, this is a limitation in the Jenkins Artifactory plugin. Here is the reason why -

Before downloading files from Artifactory, the Jenkins Artifactory plugin executes an AQL query that was built from the provided pattern. Running an AQL query on a remote non-Artifactory repository is currently not supported by Artifactory.

To download a file from a remote repository you may execute a curl command with a direct link to the file:

curl -H "Authorization: Bearer xxxxx" -X GET <jfrog-instance-url>/artifactory/centos-remote/images/<file-name> -o <file-name>

Sources:

  1. Uploading and Downloading Files
  2. Artifactory Query Language