From b5d7a4f5989b4f9c79de3baa9876ef0e2b93e8c5 Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Mon, 12 Aug 2024 19:48:18 -0400 Subject: [PATCH] fix(release): add `minor` step to internal release create command (#64377) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds the ability to use `--type minor` when running `sg release create` during the release process. For the time being this step is the _same_ as `--type patch` which is the default, however this allows us to differentiate the two types now and prepares for when/if the two types diverge. This also clears up the some confusion as the `sg release` command _can_ accept `--type minor` already and one would expect that to be the choice when you are in fact cutting a minor type. Closes: https://linear.app/sourcegraph/issue/REL-351/sourcegraphsourcegraph64377-fixrelease-add-minor-step-to-internal ## Test plan Tested locally with `--type minor` tag. ```shell ➜ sourcegraph git:(08-08-jdp_release_minor-flag-addition) sg release create --version 5.6.877 --type minor 👉 [ setup] Finding release manifest in "." [ setup] No explicit branch name was provided, assuming current branch is the target: 08-08-jdp_release_minor-flag-addition [ setup] Found manifest for "sourcegraph" (github.com/sourcegraph/sourcegraph) [ meta] Owners: @sourcegraph/release [ meta] Repository: github.com/sourcegraph/sourcegraph 👉 [ vars] Variables [ vars] version="v5.6.877" [ vars] tag="5.6.877" [ vars] config="{\"version\":\"v5.6.877\",\"inputs\":\"\",\"type\":\"minor\"}" [ vars] git.branch="08-08-jdp_release_minor-flag-addition" [ vars] is_development="false" .... Stuff here [ buildkite] Build created, see: [ buildkite] "https://buildkite.com/sourcegraph/sourcegraph/builds/287192" [ step] Step "buildkite" succeeded ``` ## Changelog Internal change, N/A --- release.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/release.yaml b/release.yaml index 5df363a3b51..3d7b1132dcb 100644 --- a/release.yaml +++ b/release.yaml @@ -51,6 +51,32 @@ internal: echo "Build created, see:" echo $body | jq .web_url fi + minor: + - name: 'buildkite' + cmd: | + echo "Triggering build on sourcegraph/sourcegraph with VERSION={{version}} on branch {{git.branch}}" + body=$(wget --content-on-error -O- --header="Content-Type: application/json" --header="Authorization: Bearer $BUILDKITE_ACCESS_TOKEN" --post-data '{ + "commit": "HEAD", + "branch": "{{git.branch}}", + "message": "Internal release build for {{version}}", + "env": { + "RELEASE_INTERNAL": "true", + "VERSION": "{{tag}}", + "IS_DEVELOPMENT_RELEASE": "{{is_development}}" + } + }' https://api.buildkite.com/v2/organizations/sourcegraph/pipelines/sourcegraph/builds) + exit_code=$? + + if [ $exit_code != 0 ]; then + echo "❌ Failed to create build on Buildkite, got:" + echo "--- raw body ---" + echo $body + echo "--- raw body ---" + exit $exit_code + else + echo "Build created, see:" + echo $body | jq .web_url + fi finalize: steps: - name: 'Register on release registry'