Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

pass the build name to artifactory #131

Open
regevbr opened this issue Dec 10, 2017 · 3 comments
Open

pass the build name to artifactory #131

regevbr opened this issue Dec 10, 2017 · 3 comments

Comments

@regevbr
Copy link

regevbr commented Dec 10, 2017

Artifactory supports builds. The build in Artifactory is a way to group together a bunch of artifacts under the same roof and linking them to the CI that created them.
This can help in 2 ways:

  • Artifactory will show the build number in the metadata of the artifacts, which helps understanding which build created the artifacts.
  • When working with snapshots and production Artifactory repositories (as discussed in artifactory releases management question #122), we can easily promote the artifacts of the build from snapshot to production without the need to realize all the artifacts created by the build and copying them one by one. This is done using the promote api call of Artifactory.

We can utilize the metadata-resource using the opinionated pipeline I wrote there.

I know that getting the metadata of a build can lead to an anti-pattern but I believe that what I suggest here is a must and we already use it in our pipelines.

@marcingrzejszczak and @ciberkleid what do you say?

@marcingrzejszczak
Copy link
Contributor

That's really interesting. Could you provide some screenshots of how you would see that be done (from Artifactory's perspective)? There is a similar way to achieve this via Nexus so maybe we could fix this from code's perspective only once

@regevbr
Copy link
Author

regevbr commented Dec 18, 2017

image
image
image

echo "Promoting build to production repo"
        local appName=$(retrieveAppName)
        local args="{\"status\": \"Deployed\",\"comment\": \"moving to production\",\"copy\": true,\"sourceRepo\": \"${REPO_SNAPSHOT}\",\"targetRepo\": \"${REPO_RELEASE}\",\"properties\": {\"retention.pinned\":[\"7\"]}}"
        curl --fail -u "${artifactory_user}:${artifactory_password}" -H "Content-Type: application/json" -X POST -d "'$args'" "${artifactory_contextUrl}/api/build/promote/${appName}/${PASSED_PIPELINE_ID}"

@regevbr
Copy link
Author

regevbr commented Dec 18, 2017

The metadata-resource has a full usage example of this idea including the gradle changes requierd

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants