Commit afe0c653b4 for bind
commit afe0c653b49d4700145967149d0511d3286e30af
Author: Michał Kępień <michal@isc.org>
Date: Tue Sep 22 11:03:56 2026 +0200
Report autorebase errors after merging tags back
When rebasing a security branch on top of a maintenance branch that just
had a release tag merged back into it, it may happen that the commit
determined to be the first one causing conflicts is the commit merging
the tag back. Since that commit is also the one that the script is
supposed to rebase the security branch on top of, the "git log"
invocation that attempts to determine the first conflicting merge
request returns an empty string (because ${CONFLICT_COMMIT} and
${BASE_COMMIT} are the same commit hash), breaking the logic in the rest
of "after_script" in a way that prevents an autorebase error from being
reported via Zulip. Handle this scenario gracefully, so that it gets
reported like any other autorebase failure.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 44ba1a9e88..459a30fd9a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2524,6 +2524,7 @@ merged-metadata:
REASON_DETAILS=""
if git rebase --abort; then
# Rebase failed; try applying recent commits from the base branch on top of the branch being rebased to determine which one introduces conflicts
+ REASON="merge conflict introduced by a change in the base branch"
git rebase --rebase-merges "${CI_COMMIT_SHA}" "${BASE_COMMIT}" || true
CONFLICT_COMMIT="$(git rev-parse REBASE_HEAD)"
CONFLICT_COMMIT_AUTHOR_LOGIN="$(git log --max-count=1 --pretty="%al" "${CONFLICT_COMMIT}")"
@@ -2534,10 +2535,11 @@ merged-metadata:
CONFLICT_COMMIT_AUTHOR="\`${CONFLICT_COMMIT_AUTHOR_LOGIN}\`"
fi
CONFLICT_COMMIT_MERGE="$(git log --reverse --merges --pretty="%H" "${CONFLICT_COMMIT}..${BASE_COMMIT}" | head -1)"
- read -r CONFLICT_COMMIT_MERGE_REQUEST_PROJECT CONFLICT_COMMIT_MERGE_REQUEST_ID < <(git log --max-count=1 "${CONFLICT_COMMIT_MERGE}" | sed -n -E 's|^\s*See merge request ([a-z-]+/bind9)!([0-9]+).*|\1 \2|p' | head -1)
- REASON="merge conflict introduced by a change in the base branch"
- REASON_DETAILS="${REASON_DETAILS}\n**First bad commit**: [${CONFLICT_COMMIT}](https://gitlab.isc.org/${CONFLICT_COMMIT_MERGE_REQUEST_PROJECT}/-/commit/${CONFLICT_COMMIT}) (authored by ${CONFLICT_COMMIT_AUTHOR})"
- REASON_DETAILS="${REASON_DETAILS}\n**First bad merge request**: https://gitlab.isc.org/${CONFLICT_COMMIT_MERGE_REQUEST_PROJECT}/-/merge_requests/${CONFLICT_COMMIT_MERGE_REQUEST_ID}"
+ if [ -n "${CONFLICT_COMMIT_MERGE}" ]; then
+ read -r CONFLICT_COMMIT_MERGE_REQUEST_PROJECT CONFLICT_COMMIT_MERGE_REQUEST_ID < <(git log --max-count=1 "${CONFLICT_COMMIT_MERGE}" | sed -n -E 's|^\s*See merge request ([a-z-]+/bind9)!([0-9]+).*|\1 \2|p' | head -1)
+ REASON_DETAILS="${REASON_DETAILS}\n**First bad commit**: [${CONFLICT_COMMIT}](https://gitlab.isc.org/${CONFLICT_COMMIT_MERGE_REQUEST_PROJECT}/-/commit/${CONFLICT_COMMIT}) (authored by ${CONFLICT_COMMIT_AUTHOR})"
+ REASON_DETAILS="${REASON_DETAILS}\n**First bad merge request**: https://gitlab.isc.org/${CONFLICT_COMMIT_MERGE_REQUEST_PROJECT}/-/merge_requests/${CONFLICT_COMMIT_MERGE_REQUEST_ID}"
+ fi
else
# Rebase did not fail; most likely, this is a build failure, or the job was canceled
if [ "${CI_JOB_STATUS}" = "failed" ]; then