From f4bc8e0e852ccadc6476f5d3fff7455015daf478 Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Mon, 16 Dec 2024 11:21:29 -0500 Subject: [PATCH 1/2] add step to release to update main with latest version --- release.yaml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/release.yaml b/release.yaml index b75dd5c8..cdeb53b3 100644 --- a/release.yaml +++ b/release.yaml @@ -332,6 +332,64 @@ promoteToPublic: cat << EOF | buildkite-agent annotate --style info Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/{{version}}). EOF + + - 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: "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 + internal_branch="promote/release-{{version}}-update-main" + gh pr create \ + --fill \ + --draft \ + --base "$internal_branch" \ + --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". + - name: 'Promote on release registry' cmd: | echo "Promoting deploy-sourcegraph-k8s {{version}} release on release registry" From 3973e8b3342230417120cdce0ef994cdc29f4589 Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Tue, 17 Dec 2024 17:12:57 -0500 Subject: [PATCH 2/2] move new step to last --- release.yaml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/release.yaml b/release.yaml index cdeb53b3..db0b1678 100644 --- a/release.yaml +++ b/release.yaml @@ -333,6 +333,23 @@ promoteToPublic: Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/{{version}}). EOF + - name: 'Promote on release registry' + cmd: | + echo "Promoting deploy-sourcegraph-k8s {{version}} release on release registry" + body=$(wget --content-on-error -O- --header="Content-Type: application/json" --header="Authorization: ${RELEASE_REGISTRY_TOKEN}" --post-data '' "https://releaseregistry.sourcegraph.com/v1/releases/k8s/{{version}}/promote") + exit_code=$? + + if [ $exit_code != 0 ]; then + echo "❌ Failed to promote release on release registry, got:" + echo "--- raw body ---" + echo $body + echo "--- raw body ---" + exit $exit_code + else + echo "Build created, see:" + echo $body | jq .web_url + fi + - name: "update main with latest version" cmd: | set -eu @@ -390,19 +407,3 @@ promoteToPublic: --body "Test plan: automated release PR, CI will perform additional checks" echo "🚢 Please check the associated CI build to ensure the process completed". - - name: 'Promote on release registry' - cmd: | - echo "Promoting deploy-sourcegraph-k8s {{version}} release on release registry" - body=$(wget --content-on-error -O- --header="Content-Type: application/json" --header="Authorization: ${RELEASE_REGISTRY_TOKEN}" --post-data '' "https://releaseregistry.sourcegraph.com/v1/releases/k8s/{{version}}/promote") - exit_code=$? - - if [ $exit_code != 0 ]; then - echo "❌ Failed to promote release on release registry, got:" - echo "--- raw body ---" - echo $body - echo "--- raw body ---" - exit $exit_code - else - echo "Build created, see:" - echo $body | jq .web_url - fi