0
votes

I am using rtDownload DSL block of the Jenkins JFrog Artifactory plugin in my Jenkins pipeline to download some artifacts from Artifactory OSS. This is how my rtDownload step looks.

      rtDownload (
        serverId: "artifactory",
        spec:
              """{
                "files": [
                  {
                    "pattern": "esb-dev-local/**",
                    "target": "artifacts/",          
                    "build": "TestJob/58"
                  }
               ]
              }"""
      )

However, this seems to download all the files that match the Build Name (TestJob) and doesn't filter by the build number. I can see the Build IDs in artifactory correctly. Any clues on what I may be doing wrong?

Here's the output from Jenkins

[Pipeline] rtDownload
Downloading artifacts using pattern: esb-dev-local/**
Beginning to resolve Build Info published dependencies.
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_58/<MASKED>-1.0_58.pom'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58-cfg.zip'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58-cfg.zip' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_58/<MASKED>-1.0_58-cfg.zip'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_58/<MASKED>-1.0_58.pom'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_32/<MASKED>-1.0_32.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_32/<MASKED>-1.0_32.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_32/<MASKED>-1.0_32.pom'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.jar'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.jar' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_58/<MASKED>-1.0_58.jar'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.jar'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_58/<MASKED>-1.0_58.jar' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_58/<MASKED>-1.0_58.jar'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_46/<MASKED>-1.0_46.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_46/<MASKED>-1.0_46.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_46/<MASKED>-1.0_46.pom'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/${projVersion}/<MASKED>-${projVersion}.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/${projVersion}/<MASKED>-${projVersion}.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/${projVersion}/<MASKED>-${projVersion}.pom'
Downloading 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_33/<MASKED>-1.0_33.pom'...
Successfully downloaded 'http://<MASKED>:8081/artifactory/esb-dev-local/<MASKED>/1.0_33/<MASKED>-1.0_33.pom' to '/var/lib/jenkins/workspace/<MASKED>/artifacts/<MASKED>/1.0_33/<MASKED>-1.0_33.pom'
Finished resolving Build Info published dependencies.
2
just a side comment - ' * ' works as wildcard, so one is enough and is exactly the same as a few consecutive ones (maybe just a typo, but just incase). - Prostagma
@Prostagna does * also match the'/' character? Sometimes ** is used to match a deep folder structure. - Moberg

2 Answers

2
votes

The artifacts downloaded are equal (by checksum) to the ones belong to the requested build (name & number).

In the scenario where several artifacts match a checksum listed in a build, the correct download path is determined by the artifact's properties (build name & number). However, since Artifactory OSS does not support artifacts properties, the path returned is undetermined.

This is why you see some artifacts downloaded from the paths of other build numbers. These artifacts were correctly downloaded, but from a seemingly different path.

0
votes

You can try to use specPath sourcing from a json file