Skip to content

Instantly share code, notes, and snippets.

@caoilte
Created March 5, 2016 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caoilte/13a9d59d2635f9d15f71 to your computer and use it in GitHub Desktop.
Save caoilte/13a9d59d2635f9d15f71 to your computer and use it in GitHub Desktop.
How to get the latest version of an RPM from an Artifactory Repository
echo 'items.find(
{
"repo":{"$eq":"<REPO_NAME>"},
"name":{"$match":"<RPM_NAME>*"}
}
).include("name", "@rpm.metadata.release").sort({"$desc" : ["name"]}).limit(1)' > aql.json
curl -X POST -Taql.json --user <USER>:<PASSWORD> "https://<ARTIFACTORY>/api/search/aql" | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['properties'][0]['value'];"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment