From 1258078e8a111c9b61634bf3362b312c1a0ede3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Mon, 5 Aug 2024 10:21:46 +0200 Subject: [PATCH 1/2] Automatically adjust MR metadata after merge 1. Set milestone to 'Not released yet' after merge We will set milestone to actual version number when we actually tag a particular version. This will get rid of mass MR reassignment when we do last minute changes to a release plan etc. 2. Adjust No CHANGES and Release Notes MR labels to match gitchangelog workflow. (cherry picked from commit 3165261ecd7468c5f30eec0f50b4b43e556b7194) (cherry picked from commit d1c64d588b5d2b293d6b4a366372c61043caba30) --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc1df1f9c5..babd61f431 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -65,6 +65,7 @@ stages: - performance - docs - postcheck + - postmerge - release ### Runner Tag Templates @@ -1530,3 +1531,37 @@ pairwise: variables: - $PAIRWISE_TESTING needs: [] + +.post_merge_template: &post_merge + <<: *base_image + stage: postmerge + needs: [] + # post-merge processes should run even if another MR was merged while the job was running (or queued) + interruptible: false + variables: + # automated commits will inherit identification from the user who pressed Merge button + GIT_COMMITTER_NAME: $GITLAB_USER_NAME + GIT_COMMITTER_EMAIL: $GITLAB_USER_EMAIL + # avoid leftover branches from previous jobs + GIT_STRATEGY: clone + # assumed max depth of a MR for backport or a rebased force-push + GIT_DEPTH: 1000 + before_script: + # force-pushes should not trigger process automation (happens only in -sub branches) + - > + echo "previous branch tip: $CI_COMMIT_BEFORE_SHA" + - set +o pipefail; git log --format='%H' | grep --silent "$CI_COMMIT_BEFORE_SHA" && PREVIOUS_TIP_REACHABLE=1 + - test "$PREVIOUS_TIP_REACHABLE" != "1" && echo "force-push detected, stop" && exit 1 + # non-fast-forward merges are disabled so we have to have merge commit on top + - MERGE_REQUEST_ID="$(git log -1 --format='%b' | sed --silent -e 's/^See merge request [^!]\+!//p')" + - > + : stop if this is not a merge request + - test "$MERGE_REQUEST_ID" -ge 0 + - git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git + +merged-metadata: + <<: *post_merge + rules: + - if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+(-sub)?$/ || $CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+.[0-9]+-release$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)' + script: + - bind9-qa/releng/after_merge.py "$CI_PROJECT_ID" "$MERGE_REQUEST_ID" From bed0aea14f67a3ae69cd13fabb3d5152fe762fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Fri, 23 Aug 2024 09:34:20 +0200 Subject: [PATCH 2/2] Remove milestone check from dangerfile Milestone is automatically set by 'merged-metadata' CI job to 'Not released yet' so it does not matter what the original value was. (cherry picked from commit 73b950dc29ba1a381fa8d1c47d12f3d2ee79cbe9) --- dangerfile.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dangerfile.py b/dangerfile.py index a48131d1f7..94e2a5596f 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -181,15 +181,6 @@ for commit in danger.git.commits: f"```{line}``` ({len(line)} > 72 characters)." ) -############################################################################### -# MILESTONE -############################################################################### -# -# FAIL if the merge request is not assigned to any milestone. - -if not danger.gitlab.mr.milestone: - fail("Please assign this merge request to a milestone.") - ############################################################################### # BACKPORT & VERSION LABELS ###############################################################################