1
votes

Is there any automated way to get artifact download URL back ?

I'm working with maven projects , I use bamboo for build automation.

After successful Build completion, artifacts will be pushed Jfrog artifactory.

My requirement here is to get the artifact download URL back in an automated way(Using bamboo Plugins, Rest API, Jfrog CLI, Maven or any other)

2
You could probably do a search. - DarthFennec
@DarthFennec,Thanks for the response, Is there any script that you have to get the artifact download URL ? with the search i see that, i can get repo, path , artifact created dates, promotions ,status, users but not the URL. Appreciate your response - san web
You're just looking at the AQL search, but that link is to the entire section of search endpoints (most of the rest of which give you a download URL). You can choose one to use depending on what information you already have about the artifact: for example, quick or pattern search if you have part of the filename or path, GAVC search if you have the Maven coordinates, property or checksum search if you have that information, or the build search if you have the build name and number. Those should all give you download URLs. - DarthFennec
@DarthFennec Thanks for the response, Looks like GAVC search will be sufficient for my need. "GAVC Search, As i have Maven coordinates: GroupId, ArtifactId, Version " Could you please help me with steps to use GAVC search, Right now i have got admin access to artifactory instance and not sure how and where to start "GAVC search" as i'm pretty new to REST API stuff. I really appreciate your time. - san web
Well, I don't know much about Bamboo, but from what I'm reading it looks like it uses bash scripts or batch/powershell (depending on your platform) for build scripts. I assume this is the environment you're working in? In that case you probably want to use the curl command to call the API (curl -u username:password -X GET "http://host/artifactory/api/search/gavc?g=group&a=artifact&v=version&c=class&repos=repo" or something). That'll give you JSON, which you can parse using jq (if available) or sed or something. Bamboo might have a better way that I'm not aware of, though. - DarthFennec

2 Answers

0
votes

You can use the Build Artifacts Search REST API endpoint. You will need to send the build name + number in the JSON, Artifactory will return the Download URI's for the build artifacts

0
votes

I have used jenkins with artifactory and with every successful build a buildinfo.json is published to the artifactory. the buildinfo json is a meta data file. You can pass the build no. you get parse the buildinfo json for the download url of the artifacts.

Worth a try since you are using the open source version.