0
votes

My artifactory [Generic] repo structure is like this:

org/component/baseRev/branch/

The build job that runs in jenkins produces a zip artifact which is uploaded to this path using artifactory plugin with a file name: component-fileItegRev.zip where fileItegRev is the build number. So I end up with something like this in my repo:

.../branch/
.....component-120.zip
.....component-121.zip
.....component-122.zip
.....component-123.zip

The other pipeline then is trying to download the latest artifact from the abovementioned folder using artifactory plugin in jenkins and the file spec like this:

{
    "files": [
        {
            "pattern": "org/component/baseRev/branch/",
            "target": "Download\\",
            "build": "buildName",
            "explode": "true",
            "flat" : "true"
        }
        ]
    }

The file spec documentation in Artifactory states that if I specify build name without build number, then the latest will be used to pull the artifact. This is not happening.

I verified that if I specify build property in the form of:

"build": "buildName/123"

it will find and download the zip with that version in the file name. I also tried to explicitly specify

"build": "buildName/LATEST"

which also doesn't work. What am I doing wrong?

I've also tried using jfrog cli download command using this spec file and it also couldn't find latest. I was able to find latest file using jfrog cli and

"sortBy": ["created"],
"sortOrder": "desc",
"limit": 1

params in the spec (as described here), but I'm still wondering why "build" property of the file spec doesn't work as described in their documentation.

1

1 Answers

1
votes

Just in case someone else runs into this. We found out that build property in the file spec was working correctly all along. The issue was that as we were experimenting with publishing our branch builds to Artifactory, its build info got corrupted in the process. Once we cleaned out all build info in Artifactory for this branch and rebuilt, we were able to pull the latest build using build_name/LATEST option.