From 55f4f4c7cbde54dc6b41619b189a840a6858b4b0 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Wed, 21 Oct 2026 10:30:37 -0700 Subject: [PATCH] release: Hand "Update main" PRs over to the releaseworker (#492) Promote finalize opens a draft "Update main: build vX" PR after every release, but none has ever been merged, so `main` here lags many releases behind. Its Buildkite build also always fails: `promote/release-vX-update-main` matches the `^promote\/release-.*` release steps, and `(promote) Release: test` stops with "did not find serialized config" (for example, [deploy-sourcegraph-k8s build 1187](https://buildkite.com/sourcegraph/deploy-sourcegraph-k8s/builds/1187)). The releaseworker now opens the "Update main" PR itself after the promote build passes, with squash auto-merge enabled and the Platform team requested as reviewers ([sourcegraph/sourcegraph#17347](https://github.com/sourcegraph/sourcegraph/pull/17347)). This PR: - removes the "Update main" steps from `promoteToPublic.finalize` in `release.yaml`, so the releaseworker and Buildkite don't both create it; - skips the `(promote) Release: test` and `(promote) Release: finalize` steps on `*-update-main` branches in `.buildkite/pipeline.yaml`. Ship this together with sourcegraph/sourcegraph#17347. Until both are live, a release either gets no "Update main" PR or a duplicate attempt that the releaseworker logs and skips. Part of [PLAT-881](https://linear.app/sourcegraph/issue/PLAT-881/close-release-generated-prs-when-release-is-complete). Matching changes: [docker#1443](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/1443), [helm#972](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/972). ## Checklist - [ ] Update CHANGELOG.md: not needed, release tooling only - [ ] Update K8s Upgrade notes: not needed - [ ] Kustomize-specific changes: none - [x] Update sister repository: [deploy-sourcegraph-helm](https://github.com/sourcegraph/deploy-sourcegraph-helm) (see below) - [x] Update sister repository: [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker) (see below) - [x] Verify all images have a valid tag and SHA256 sum (no image changes) ### Test plan Both YAML files parse, and `promoteToPublic.finalize` now contains only the tag and release registry steps. The pipeline conditions still match `promote/release-v8.1.0` and no longer match `promote/release-v8.1.0-update-main`. The next release's promote build and "Update main" PR will exercise this end to end. (cherry picked from commit bfa9a369464e2e2c1988ae857ea34e3961e4d14f) --- .buildkite/pipeline.yaml | 4 +-- release.yaml | 69 ---------------------------------------- 2 files changed, 2 insertions(+), 71 deletions(-) diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index be3c06e1..ed717ef6 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -34,7 +34,7 @@ steps: sg release run test --workdir=. --config-from-commit - label: "(promote) Release: test" - if: build.branch =~ /^promote\/release-.*/ + if: build.branch =~ /^promote\/release-.*/ && build.branch !~ /-update-main$/ plugins: - ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~ command: | @@ -57,7 +57,7 @@ steps: sg release run internal finalize --workdir=. --config-from-commit - label: "(promote) Release: finalize" - if: build.branch =~ /^promote\/release-.*/ + if: build.branch =~ /^promote\/release-.*/ && build.branch !~ /-update-main$/ plugins: - ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~ command: | diff --git a/release.yaml b/release.yaml index ae50d7c6..8aebbbb8 100644 --- a/release.yaml +++ b/release.yaml @@ -389,72 +389,3 @@ promoteToPublic: echo "Build created, see:" echo $body | jq .web_url fi - - - name: "update main with latest version" - cmd: | - set -eu - branch="promote/release-{{version}}-update-main" - echo "Checking out origin/main" - git fetch origin main - git switch main - echo "Creating branch origin/${branch}" - git switch -c "${branch}" - - - name: "sg ops" - cmd: | - set -eu - sg ops update-images \ - --kind k8s \ - --registry index.docker.io/sourcegraph \ - --docker-username=$DOCKER_USERNAME \ - --docker-password=$DOCKER_PASSWORD \ - --pin-tag {{inputs.server.tag}} \ - base/ - - - name: "sg ops (executors)" - cmd: | - set -eu - sg ops update-images \ - --kind k8s \ - --registry index.docker.io/sourcegraph \ - --docker-username=$DOCKER_USERNAME \ - --docker-password=$DOCKER_PASSWORD \ - --pin-tag {{inputs.server.tag}} \ - components/executors/ - - - name: "sg ops (migrator)" - cmd: | - set -eu - sg ops update-images \ - --kind k8s \ - --registry index.docker.io/sourcegraph \ - --docker-username=$DOCKER_USERNAME \ - --docker-password=$DOCKER_PASSWORD \ - --pin-tag {{inputs.server.tag}} \ - components/utils/migrator/ - - - name: "git:commit" - cmd: | - set -eu - branch="promote/release-{{version}}-update-main" - find . -name "*.yaml" | xargs git add - find . -name "*.yml" | xargs git add - - # Careful with the quoting for the config, using double quotes will lead - # to the shell dropping out all quotes from the json, leading to failed - # parsing. - git commit -am 'update-main: {{version}}' -m 'update main with latest release' - git push origin "${branch}" - - - name: "github:pr" - cmd: | - set -eu - # Create PR to merge release updates into main branch - gh pr create \ - --fill \ - --draft \ - --base main \ - --title "Update main: build {{version}}" \ - --body "Test plan: automated release PR, CI will perform additional checks" - echo "🚢 Please check the associated CI build to ensure the process completed". -