GitLab CI Artifact Promotion

I’m trying to promote binary artifacts in GitLab.

I want my pipeline to build and publish a snapshot every time there’s a commit. But then when I tag, I want to refer to the artifact that was already built and call that artifact by the name of the tag.

For Docker images, this works quite well because I can build and tag the Docker image with the git sha on commit. Then on git tag I can retag my docker image:sha as image:ref.

I would like a way to do this with artifacts: that are native to GitLab CI, but I do not see a way for this to work. I’d need to refer to build of a sha, not a GitLab CI build number, and I’d need it to be dynamic.

Am I barking up the wrong tree? Is there an elegant way to handle this case?

Thank you.

–Harley

Hmmm, I think you’d want something like “releases from the CI config”, planned for 12.6.

Cheers,
Michael

Hi, I’m also interested in this logic and don’t quite get how the :release part should help out with this. We use a development flow of master releasing an artifact in the syntax of ARTIFACT-VERSION-BUILDNUMBER-SNAPSHOT.EXTENSION and when promoting the snapshot to release the artifact as ARTIFACT-VERSION.EXTENSION

This flow infers that there can be multiple snapshot versions, but only one release version. Can you explain how I would achieve that using gitlab? Today we are using Jenkins + artifactory, in which we’ve got a button for each build that can promote the artifact from snapshot to release, can you provide something similar ?

Hi @sal - we are looking at adding binaries to the :release key word in https://gitlab.com/gitlab-org/gitlab/-/issues/36133, I think this gets you to where when you create a release tag, the binary will also be versioned.

3 Likes