Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Problem:

I'm trying to figure out if it is possible to download the latest binary from an artifactory repo. I'd like to use the Created property of the file if possible.

Attempt:

I can successfully download files via the rtDownload plugin

rtDownload ( serverId: 'Artifactory-1', // Build name and build number for the build-info: buildName: 'holyFrog', buildNumber: '42', // You also have the option of customising the build-info module name: module: 'my-custom-build-info-module-name', specPath: 'path/to/spec/relative/to/workspace/spec.json'

I would like to see if I can use a combination of limit and sortOrder to download the latest binary from a repo. It's not clear to me as to how I can achieve that based on the documentation: https://www.jfrog.com/confluence/display/JFROG/Using+File+Specs . Any help would be greatly appreciated!

Update: I can't use the build-name like this: Jenkins Artifactory plugin - grabbing latest artifacts

I found out that the cli supports "sortBy": ["created"], but the pipeline doesn't: https://www.jfrog.com/jira/browse/HAP-1215 . Anyone find a workaround for this?

After some source diving, I found the FileSpec class which each element in the spec is mapped to. Based on this, the sortBy, sortOrder, and limit fields should be part of the file object, not the aql object. For example:

"files": [ "aql": { "repo": "my-repo", "path": "my/artifacts/path" "sortBy": ["created", "name"], "sortOrder": "desc", "limit": 1, "target": "artifacts" Updated new plugin allows you to use such filters with patterns such as "pattern": "my_artifact_dir/*", "target": "./", "sortBy": ["created", "name"], "sortOrder": "desc", "limit": 1 c24b Aug 7 at 13:51

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .