release.yaml: share duplicated steps with YAML anchors - #955
Draft
marcleblanc2 wants to merge 2 commits into
Draft
marcleblanc2 wants to merge 2 commits into
marcleblanc2 wants to merge 2 commits into
Conversation
patch/minor/major create steps were three byte-identical copies apart
from a stray echo and the release type in the commit message and PR
title. The type is already recorded in the commit body via {{config}},
and the Temporal release workflow already titles these PRs
"(internal) release: build vX", so the copies collapse into one anchored
list.
The public-registry sg ops steps, chart:version, chart:appVersion and
helm-docs steps were also repeated between promoteToPublic.create and
promoteToPublic.finalize; they are now defined once and aliased.
Rendered steps for every operation (sg release steps) are unchanged
except for the intended commit message / PR title / step-name edits.
615 -> 354 lines.
Amp-Thread-ID: https://ampcode.com/threads/T-01a0f395-3034-73c8-90dc-e665c3d9477f
Co-authored-by: Amp <amp@ampcode.com>
Defines every anchor once, up front, so readers see the shared building blocks before the sections that use them. sg release ignores the unknown top-level key. Output of sg release steps is unchanged for every operation. Amp-Thread-ID: https://ampcode.com/threads/T-01a0f395-3034-73c8-90dc-e665c3d9477f Co-authored-by: Amp <amp@ampcode.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
release.yamlcarried the same ~100-line image-update step block five times (internal.create× patch/minor/major,promoteToPublic.create, andpromoteToPublic.finalize's update-main section). This PR defines each shared step once under a top-levelx-shared-stepskey near the top of the file (YAML anchors), and the sections below only alias them. 615 → 378 lines, no behaviour change except the intentional edits below.What changed
x-shared-steps, right afterrequirements, so a reader sees the building blocks before the sections that use them.sg releasedecodes with defaultyaml.v3settings (noKnownFields), so the unknown top-level key is ignored.internal.create.steps.patch/minor/majorall alias oneinternal-createstep list. The three copies differed only by a strayecho "updating sourcegraph images"andrelease_<type>in the commit message / PR title.release: {{version}}and PR title(internal) release: build {{version}}, which is what the Temporal workflow already produces (see (internal) release: build v8.0.0 #945). The release type is still recorded in the commit body via{{config}}.sg ops update-imagessteps,chart:version,chart:appVersionandhelm:docsare aliased intopromoteToPublic.createandpromoteToPublic.finalize.update helm docsstep renamed tohelm:docsto match the internal section.Verification
sg release steps --format jsonrendered for every operation (internal-create× patch/minor/major,internal-finalize,test,promote-to-public,promote-to-public-finalize) againstmainand this branch. The only diffs are the edits listed above; thex-shared-stepsrestructure (second commit) renders byte-identical to the first commit for every operation.sg's loader (dev/sg/internal/release/config.go) uses the defaultyaml.v3decoder, which resolves anchors/aliases.Question for @sourcegraph/release: keep
internal.create/promoteToPublic.createat all?Evidence gathered while looking at this:
sg release run testand... finalize(.buildkite/pipeline.yaml). Nothing in this repo runs thecreatesteps.sourcegraph/sourcegraph,TriggerDeployRepoWorkflows→DeployRepoReleaseCreate/DeployRepoReleasePromote(internal/releaseplatform/temporal/workflow/deployrepos*.go) reimplement thecreatephases natively via the GitHub API and never invokesg release ... create. Every internal/promote PR here since v7.5.0 ((internal) release: build v7.5.0 #903, Jul 2026) was opened bysourcegraph-bot-2with the Temporal-style title; the lastrelease.yaml-style one was (internal) release_patch: build v7.4.2513 #899 (v7.4.2513, Jun 2026).DeployReposRelease(internal/releaseplatform/temporal/workflow/batchchange.go) does shell out tosg release create, but it has no callers (only registered incmd/releaseworker), and it readsbatch-change/release.yaml, not this file.promote-release:commit by a human, i.e. someone ransg release promote-to-public --workdir .by hand as a fallback, two days after sourcegraph/sourcegraph#13551 fixed helm-docs regeneration in the workflow. Four releases since then went through the bot cleanly.So the
createsections are a manual fallback, used once in the last three months. Two options:internal.createandpromoteToPublic.create(the anchored steps move intofinalize), plus a separate PR deletingbatch-change/and the unusedDeployReposReleaseworkflow in the monorepo.deploy-sourcegraph-k8sanddeploy-sourcegraph-dockerhave the same five-copy layout; I'll mirror whichever option lands here.Test plan:
sg release stepsbefore/after diff described above; CI here doesn't executerelease.yamlon non-release branches.