From c1ad37e7bddc7cd6089a7fc5defc13caf39ae20e Mon Sep 17 00:00:00 2001 From: Yorick Peterse <yorick@yorickpeterse.com> Date: Wed, 22 Apr 2020 15:31:52 +0200 Subject: [PATCH] Don't create pipelines when preparing RCs In the days leading up to a monthly release, Release Tools will automatically create a new release candidate every day. As part of this process we merge the latest changes deployed to production into the latest stable branch. Since we use merge requests for this (as our API does not let you merge a branch directly), this will create a pipeline. To deal with this we implemented some code to cancel pipelines before merging these merge requests. Sadly this proved unreliable, as sometimes pipelines are not yet available after creating the merge request. If we then try to merge the merge request this may fail if there are pending pipelines. In this commit we change the CI config to not create a pipeline in the first place for these merge requests. This is the easiest and most reliable way of letting Release Tools merge its own merge requests, without the need for any logic that waits for and cancels any running pipelines. This fixes https://gitlab.com/gitlab-org/release-tools/-/issues/423 --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 037dddec9692..898325a0dbc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,13 @@ workflow: rules: # If `$FORCE_GITLAB_CI` is set, create a pipeline. - if: '$FORCE_GITLAB_CI' + # As part of the process of creating RCs automatically, we update stable + # branches with the changes of the most recent production deployment. The + # merge requests used for this merge a branch release-tools/X into a stable + # branch. For these merge requests we don't want to run any pipelines, as + # they serve no purpose and will run anyway when the changes are merged. + - if: '$CI_COMMIT_BRANCH =~ /^release-tools\/\d+\.\d+\.\d+-rc\d+$/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee)?$/ && $CI_PROJECT_PATH == "gitlab-org/gitlab"' + when: never # For merge requests, create a pipeline. - if: '$CI_MERGE_REQUEST_IID' # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.). -- GitLab