Reputation: 31520
https://wiki.jenkins.io/pages/viewpage.action?pageId=99910084
I can upload and download, but I just want to query and get a list of artifactory builds for a repo.
I want to get a list of all builds for a given repo to present it to the user so they can choose a previous build to deploy.
All I need is a list of the builds. I can do this with a rest call but I already have credentials and the server URL configured for the Jenkins plugin. would be nice to use the plugin.
How do i do this with the plugin (without having to do my own rest calls)?
Upvotes: 1
Views: 1966
Reputation: 5129
Just came across the same requirement. Seems still not to be supported by the Artifactory plugin.
Therefore I wrote following small pipeline script. You'd have to run it inside some node featuring curl
. So most probably this will need a linux node or cygwin installation.
String jsonData = ""
node('linux') {
withCredentials([usernamePassword(credentialsId: '<credentials id>', passwordVariable: 'password', usernameVariable: 'username')]) {
jsonData = sh(returnStdout: true, script: "curl -u '$username:$password' <url to artifactory repository>")
}
}
def json = readJSON(text: jsonData)
List<String> deployments = []
json.children.each {
echo it.uri
deployments << it.uri
}
Having that the deployments
variable will contain a list of artifacts available in the selected repository.
Upvotes: 0
Reputation: 3651
Doesn't look like it is possible yet.
This post from a few months earlier contains a possible solution (aka workaround) where the question asker, posted their own answer.
To get the list of builds I wrote a groovy class in a shared library to return the list of version numbers and the latest version number.
Upvotes: 1