Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 94672f7

Browse files
authored
feat(rel): add step to release to update main with latest version (#4399)
### Description Add step to build process that creates a PR to update `main` with the latest release version. > NOTE: ### Checklist <!-- Kubernetes and Docker Compose MUST be kept in sync. You should not merge a change here without a corresponding change in the other repository, unless it truly is specific to this repository. If uneeded, add link or explanation of why it is not needed here. --> - [NA] [CHANGELOG.md](https://github.com/sourcegraph/sourcegraph/blob/main/CHANGELOG.md) updated - [NA] [K8s Upgrade notes updated](https://github.com/sourcegraph/sourcegraph/blob/main/doc/admin/updates/kubernetes.md) - [NA] Sister [deploy-sourcegraph-k8s](https://github.com/sourcegraph/deploy-sourcegraph-docker) change: - [NA] Sister [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker) change: - [NA] All images have a valid tag and SHA256 sum - [NA] I acknowledge that [deploy-sourcegraph-k8s](https://github.com/sourcegraph/deploy-sourcegraph-k8s) is now the preferred Kubernetes deployment repository ### Test plan Release process CI <!-- As part of SOC2/GN-104 and SOC2/GN-105 requirements, all pull requests are REQUIRED to provide a "test plan". A test plan is a loose explanation of what you have done or implemented to test this, as outlined in our Testing principles and guidelines: https://docs.sourcegraph.com/dev/background-information/testing_principles Write your test plan here after the "Test plan" header. -->
1 parent dcecdbe commit 94672f7

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

release.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,77 @@ promoteToPublic:
397397
cat << EOF | buildkite-agent annotate --style info
398398
Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph/tree/{{version}}).
399399
EOF
400+
401+
- name: "update main with latest version"
402+
cmd: |
403+
set -eu
404+
branch="promote/release-{{version}}-update-main"
405+
echo "Checking out origin/main"
406+
git fetch origin "${branch}"
407+
git switch main
408+
echo "Creating branch origin/${branch}"
409+
git switch -c "${branch}"
410+
411+
- name: "sg ops (base)"
412+
cmd: |
413+
sg ops update-images \
414+
--kind k8s \
415+
--registry index.docker.io/sourcegraph \
416+
--docker-username=$DOCKER_USERNAME \
417+
--docker-password=$DOCKER_PASSWORD \
418+
--pin-tag {{inputs.server.tag}} \
419+
base/
420+
421+
- name: "sg ops (overlays)"
422+
cmd: |
423+
folders=$(find overlays -maxdepth 1 -type d \! -name "low-resource")
424+
425+
for path in $folders; do
426+
echo "updating ${path}"
427+
sg ops update-images \
428+
--kind k8s \
429+
--registry index.docker.io/sourcegraph \
430+
--docker-username=$DOCKER_USERNAME \
431+
--docker-password=$DOCKER_PASSWORD \
432+
--pin-tag {{inputs.server.tag}} \
433+
${path}/
434+
done
435+
436+
- name: "sg ops (configure)"
437+
cmd: |
438+
folders=$(find configure -maxdepth 1 -type d )
439+
440+
for path in $folders; do
441+
echo "updating ${path}"
442+
sg ops update-images \
443+
--kind k8s \
444+
--registry index.docker.io/sourcegraph \
445+
--docker-username=$DOCKER_USERNAME \
446+
--docker-password=$DOCKER_PASSWORD \
447+
--pin-tag {{inputs.server.tag}} \
448+
${path}/
449+
done
450+
- name: "git:commit"
451+
cmd: |
452+
set -eu
453+
branch="promote/release-{{version}}-update-main"
454+
find . -name "*.yaml" | xargs git add
455+
find . -name "*.yml" | xargs git add
456+
457+
# Careful with the quoting for the config, using double quotes will lead
458+
# to the shell dropping out all quotes from the json, leading to failed
459+
# parsing.
460+
git commit -am 'prep update main: {{version}}' -m 'update main with latest release'
461+
git push origin "${branch}"
462+
463+
- name: "github:pr"
464+
cmd: |
465+
set -eu
466+
internal_branch="promote/release-{{version}}-update-main"
467+
gh pr create \
468+
--fill \
469+
--draft \
470+
--base "$internal_branch" \
471+
--title "Update main: build {{version}}" \
472+
--body "Test plan: automated release PR, CI will perform additional checks"
473+
echo "🚢 Please check the associated CI build to ensure the process completed".

0 commit comments

Comments
 (0)