Add upsert git tag job
What does this MR do?
This MR adds a new tag
stage with an upsert git tag
job. This MR changes the release process. When a pipeline is run on a merge request, no changes are introduced. When a pipeline is run on the default branch after an MR has been merged, and the CREATE_GIT_TAG
environment variable is configured to true
, the upsert git tag
job will run and the following happens:
- If the
GITLAB_TOKEN
environment variable is not set, an error will be returned, since theGITLAB_TOKEN
variable is required in order to send an API request to create a release - The version from the most recent entry in the
CHANGELOG.md
file is fetched, and the script checks to see if this exists in the list of git tags. If the version exists in the list of git tags, the job returns immediately without performing any actions. If the version doesn't exist, theupsert git tag
job will send an API request to create a release. - Once a release is successfully created, a new git tag with the given version and message from the
CHANGELOG.md
will also be created. This will kick off a new pipeline for the git tag - The
git tag pipeline
will operate as it does currently, by building, tagging and pushing Docker images based on the git tag that was used to kick off the pipeline.
What are the relevant issue numbers?
gitlab-org/gitlab#342986 (closed)
Does this MR meet the acceptance criteria?
Edited by Adam Cohen