diff --git a/CHANGELOG.md b/CHANGELOG.md index 411307abe06224dc43c51f26c2a148f77dd66b7c..bdb4563f4a9b183bfbaba63dc4120242fcfc71c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.3.0] - 2024-12-05 + +### Changed + +- The release-it template is now added to the common pipeline and is gated on + there being a `.release-it.json` file present in the repository root. This + shouldn't affect any current users since this file needs to be present to use + release-it. + ## [6.2.0] - 2024-11-21 ### Added diff --git a/auto-devops/common-pipeline.yml b/auto-devops/common-pipeline.yml index 2d8cc0dbba136d87e18edcd82fe7fa45ae0c5255..2f6baf28ac47c941c2805a6e3653731e5b8b0118 100644 --- a/auto-devops/common-pipeline.yml +++ b/auto-devops/common-pipeline.yml @@ -19,6 +19,7 @@ include: - local: "/auto-devops/python-check-tags-match-version.yml" - local: "/auto-devops/mkdocs-docs.gitlab-ci.yml" - local: "/auto-devops/trigger-renovatebot.gitlab-ci.yml" + - local: "/auto-devops/release-it.yml" # Fail-safe workflow rules. These can be overridden by CI configuration which includes us. - template: Workflows/Branch-Pipelines.gitlab-ci.yml diff --git a/auto-devops/release-it.yml b/auto-devops/release-it.yml index 98ecbf8bb217821d1651886216da3ab57cfd98fe..1c9b77af969e0232c7dcfafae979e39beb6c2851 100644 --- a/auto-devops/release-it.yml +++ b/auto-devops/release-it.yml @@ -1,9 +1,17 @@ # release-it.yml enables automated release management using the release-it tool. +# +# This template is intended to be added to the common pipeline. As such no jobs are added unless specifically enabled by +# the presence of a special file named ".release-it.json" in the root of the repository. +# +# Set the RELEASE_IT_DISABLED variable to disable release-it jobs if they are erroneously enabled. +# +# The USE_MERGE_REQUEST_RELEASE_FLOW variable is not namespaced. To avoid breaking existing users, this variable is left +# as is. include: - local: /fragments/get-gcp-secrets.yml -.release-base: +.release-it:base: image: name: registry.gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/release-it:latest variables: @@ -40,24 +48,30 @@ include: tags: - $GKE_RUNNER_TAG -update-release-merge-request: - extends: .release-base +release-it:update-release-merge-request: + extends: .release-it:base stage: development script: /opt/devops/update-merge-request.sh needs: [] rules: + - if: $RELEASE_IT_DISABLED + when: never # This job should only run if this variable is not null. - if: $USE_MERGE_REQUEST_RELEASE_FLOW == null when: never # This is the main rule to run this job if we're using the merge request workflow and the pipeline is running on # either the default branch or a branch named "release/fix-...". - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^release\/fix-.*$/i) && $CI_COMMIT_MESSAGE !~ /chore\(release\)/ + exists: + - .release-it.json -release: - extends: .release-base +release-it:release: + extends: .release-it:base stage: production script: /opt/devops/release.sh rules: + - if: $RELEASE_IT_DISABLED + when: never # This rule stops the job running if it is a new or rebased branch ($CI_COMMIT_BEFORE_SHA == # "0000000000000000000000000000000000000000") or if the pipeline was manually triggered via the web UI but only if # we're using the merge request workflow. @@ -66,6 +80,8 @@ release: # When using the merge request workflow, this release job should only trigger for pipelines on the default branch or # branches starting "release/fix-" and only if the automated release bot commit was merged as the most recent commit. - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^release\/fix-.*$/i) && $USE_MERGE_REQUEST_RELEASE_FLOW && $CI_COMMIT_MESSAGE =~ /chore\(release\)/ + exists: + - .release-it.json # If we're using the merge request workflow but all previous rules have not matched then we do not run the # release job. - if: $USE_MERGE_REQUEST_RELEASE_FLOW @@ -74,3 +90,5 @@ release: # default branch or a branch starting "release/fix-". Note that we don't run the job if the last commit was the release # commit by the bot account otherwise we'll get stuck in an infinite loop. - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^release\/fix-.*$/i) && $CI_COMMIT_MESSAGE !~ /chore\(release\)/ + exists: + - .release-it.json