From 9577c6ebe9cd2b9034c8ba6d09265eb306284c48 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Mon, 3 Aug 2026 13:09:33 +0200 Subject: [PATCH 1/4] [backport] keep backport branch's own .go-version during branch creation Instead of overwriting .go-version from the source branch, activate the backport branch's Go version via gvm before running go mod tidy so that go.mod stays consistent with the branch's toolchain requirement. Restore the source branch Go version afterward for the rest of the script. Co-Authored-By: Claude Sonnet 4.6 --- .buildkite/scripts/backport_branch.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.buildkite/scripts/backport_branch.sh b/.buildkite/scripts/backport_branch.sh index 38073c3cef7..8fdc67ca030 100755 --- a/.buildkite/scripts/backport_branch.sh +++ b/.buildkite/scripts/backport_branch.sh @@ -172,13 +172,6 @@ updateBackportBranchContents() { git checkout "$SOURCE_BRANCH" -- "magefile.go" git add magefile.go - # As this script runs in the context of the main branch (mainly go mod tidy), we need to copy - # the .go-version file from the main branch to the backport branch. This avoids failures - # installing dependencies in the backport Pull Request. - echo "--- Copying .go-version from $SOURCE_BRANCH..." - git checkout "$SOURCE_BRANCH" -- ".go-version" - git add .go-version - # Restore workflows from the main branch since modifying them requires extra permissions. # > error: GH013: Repository rule violations found for ... # > refusing to allow a GitHub App to create or update workflow `.github/workflows/bump-elastic-stack-version.yml` without `workflows` permission @@ -191,11 +184,17 @@ updateBackportBranchContents() { git checkout "$SOURCE_BRANCH" -- "tools.go" git add tools.go + # Switch to the backport branch's Go version so go mod tidy keeps go.mod as-is. + eval "$(gvm "$(cat .go-version)")" + # Run go mod tidy to update just the dependencies related to magefile and dev scripts echo "--- Running go mod tidy to update dependencies related to magefile and dev scripts..." go mod tidy git add go.mod go.sum + + # Restore the Go version from the source branch for the rest of the script execution. + eval "$(gvm "$(git show "${SOURCE_BRANCH}:.go-version")")" fi if [ "${REMOVE_OTHER_PACKAGES}" == "true" ]; then From f4c2c178e42f6c1d76ed3a88ca5ba32b1cc18fb0 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Mon, 3 Aug 2026 13:23:21 +0200 Subject: [PATCH 2/4] Show go version in buildkite output --- .buildkite/scripts/backport_branch.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/backport_branch.sh b/.buildkite/scripts/backport_branch.sh index 8fdc67ca030..0d1c6198e9d 100755 --- a/.buildkite/scripts/backport_branch.sh +++ b/.buildkite/scripts/backport_branch.sh @@ -184,17 +184,21 @@ updateBackportBranchContents() { git checkout "$SOURCE_BRANCH" -- "tools.go" git add tools.go + # Run go mod tidy to update just the dependencies related to magefile and dev scripts + echo "--- Running go mod tidy to update dependencies related to magefile and dev scripts..." # Switch to the backport branch's Go version so go mod tidy keeps go.mod as-is. eval "$(gvm "$(cat .go-version)")" + echo "Setting go version from backport branch" + go version - # Run go mod tidy to update just the dependencies related to magefile and dev scripts - echo "--- Running go mod tidy to update dependencies related to magefile and dev scripts..." go mod tidy git add go.mod go.sum # Restore the Go version from the source branch for the rest of the script execution. + echo "Restoring go version from ${SOURCE_BRANCH} branch" eval "$(gvm "$(git show "${SOURCE_BRANCH}:.go-version")")" + go version fi if [ "${REMOVE_OTHER_PACKAGES}" == "true" ]; then From 596a9532b6224b16dafb38029a7e61ac1c514241 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Mon, 3 Aug 2026 13:25:53 +0200 Subject: [PATCH 3/4] Run tests --- .buildkite/scripts/backport_branch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.buildkite/scripts/backport_branch.sh b/.buildkite/scripts/backport_branch.sh index 0d1c6198e9d..ba459846ee9 100755 --- a/.buildkite/scripts/backport_branch.sh +++ b/.buildkite/scripts/backport_branch.sh @@ -194,6 +194,8 @@ updateBackportBranchContents() { go mod tidy git add go.mod go.sum + echo "Run tests with $(go version)" + mage check # Restore the Go version from the source branch for the rest of the script execution. echo "Restoring go version from ${SOURCE_BRANCH} branch" From 2dd344323eb640c7061b36378f19c08a7b9cbc8c Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Mon, 3 Aug 2026 14:58:05 +0200 Subject: [PATCH 4/4] Revert "Run tests" This reverts commit 596a9532b6224b16dafb38029a7e61ac1c514241. --- .buildkite/scripts/backport_branch.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.buildkite/scripts/backport_branch.sh b/.buildkite/scripts/backport_branch.sh index ba459846ee9..0d1c6198e9d 100755 --- a/.buildkite/scripts/backport_branch.sh +++ b/.buildkite/scripts/backport_branch.sh @@ -194,8 +194,6 @@ updateBackportBranchContents() { go mod tidy git add go.mod go.sum - echo "Run tests with $(go version)" - mage check # Restore the Go version from the source branch for the rest of the script execution. echo "Restoring go version from ${SOURCE_BRANCH} branch"