Skip to content

Commit

Permalink
Update release manifest + QA (#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchabran authored Mar 22, 2024
1 parent eeddc30 commit ae4d463
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 43 deletions.
1 change: 0 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ fi
trap remove_pidfile EXIT
echo $$ > "$PIDFILE"


echo "Installing asdf dependencies as defined in '${WORKDIR}/.tool-versions':"
asdf install
24 changes: 18 additions & 6 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,37 @@ steps:
agents: { queue: "standard" }
soft_fail: true

- label: "Release: test"
if: "build.branch =~ /^wip_/"
# Please keep in mind that the release manifest uses specific branch names when creating releases.
# Therefore, if you update them, or if you decide to change how we detect what kind of build we're dealing
# with, please update this file as well.
- label: "(internal) Release: test"
if: build.branch =~ /^internal\/release-.*/
plugins:
- ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~
command: |
sg release run test --workdir=. --config-from-commit
- label: "(promote) Release: test"
if: build.branch =~ /^promote\/release-.*/
plugins:
- ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~
command: |
sg release run test --workdir=. --config-from-commit
- wait

- label: "Release: finalize"
if: "build.branch =~ /^wip_/"
- label: "(internal) Release: finalize"
if: build.branch =~ /^internal\/release-.*/
plugins:
- ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~
command: |
sg release run internal finalize --workdir=. --config-from-commit
- label: "Promote to public: finalize"
if: build.message =~ /^promote_release/ && build.branch =~ /^wip_release/
- label: "(promote) Release: finalize"
if: build.branch =~ /^promote\/release-.*/
plugins:
- ssh://git@github.com/sourcegraph/sg-buildkite-plugin.git#main: ~
command: |
sg release run promote-to-public finalize --workdir=. --config-from-commit
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ nodejs 16.7.0
yarn 1.22.4
shellcheck 0.7.1
golang 1.19.8
github-cli 2.46.0
python system
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ We've made our deployment configurations open source to better serve our custome
What if your organization wants a multi-machine deployment without using Kubernetes?
What if you use a different container management platform, for example?
Anyone using a container management platform other than Kubernetes (Netflix's [Titus](https://netflix.github.io/titus/), Apache's [Mesos](http://mesos.apache.org/documentation/latest/docker-containerizer/), etc.) can use our [Pure-Docker Sourcegraph cluster deployment reference](./pure-docker/README.md) to deploy Sourcegraph.

---

### Contributing

#### Releasing

Please see the [documentation](https://go/releases).
143 changes: 107 additions & 36 deletions release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta:
- "@sourcegraph/release"
repository: "github.com/sourcegraph/deploy-sourcegraph-docker"
inputs:
releaseId: server
- releaseId: server
requirements:
- name: "go"
cmd: "which go"
Expand All @@ -14,116 +14,187 @@ requirements:
cmd: "which gh"
fixInstructions: "install GitHub cli"
internal:
# Please keep in mind that the CI pipeline uses the branch names defined below when creating releases.
# Therefore, if you update them, or if you decide to change how we detect what kind of build we're dealing
# with, please update this file as well.
create:
steps:
patch:
- name: docker(compose):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind compose --pin-tag {{tag}} docker-compose/
- name: docker(shell):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind shell --pin-tag {{tag}} pure-docker/
- name: "git:branch"
cmd: |
branch="wip_{{version}}"
set -eu
branch="internal/release-{{version}}"
git switch -c "${branch}"
git commit -am 'release_patch: {{version}}' -m '{{config}}'
git push origin ${branch}
- name: "gh"
- name: "github:pr"
cmd: |
gh pr create -f -t "PRETEND RELEASE WIP: release_patch: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks"
gh pr create \
--fill \
--draft \
--title "(internal) release_patch: 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".
minor:
- name: docker(compose):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind compose --pin-tag {{tag}} docker-compose/
- name: docker(shell):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind shell --pin-tag {{tag}} pure-docker/
- name: "git:branch"
cmd: |
branch="wip_{{version}}"
set -eu
branch="internal/release-{{version}}"
git switch -c "${branch}"
git commit -am 'release_minor: {{version}}' -m '{{config}}'
git push origin ${branch}
- name: "gh"
- name: "github:pr"
cmd: |
gh pr create -f -t "PRETEND RELEASE WIP: release_minor: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks"
gh pr create \
--fill \
--draft \
--title "(internal) release_minor: 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".
major:
- name: docker(compose):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind compose --pin-tag {{tag}} docker-compose/
- name: docker(shell):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal
sg ops update-images --registry ${registry} --kind shell --pin-tag {{tag}} pure-docker/
- name: "git:branch"
cmd: |
branch="wip_{{version}}"
set -eu
branch="internal/release-{{version}}"
git switch -c "${branch}"
git commit -am 'release_major: {{version}}' -m '{{config}}'
git push origin ${branch}
- name: "gh"
- name: "github:pr"
cmd: |
gh pr create -f -t "PRETEND RELEASE WIP: release_major: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks"
gh pr create \
--fill \
--draft \
--title "(internal) release_major: 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".
finalize:
steps:
- name: "git:finalize"
cmd: |
set -e
branch="wip_release-{{version}}"
git switch -c "${branch}"
echo "pushing branch ${branch}"
git push origin "${branch}"
git checkout -
set -eu
branch="internal/release-{{version}}"
# Post a comment on the PR.
cat << EOF | gh pr comment "$branch" --body-file -
- :green_circle: Internal release is ready for promotion!
- :warning: Do not close/merge that pull request or delete the associated branch if you intend to promote it.
EOF
# Post an annotation.
cat << EOF | buildkite-agent annotate --style info
Internal release is ready for promotion under the branch [\`$branch\`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/$branch).
EOF
test:
steps:
- name: "foo"
- name: "Placeholder"
cmd: |
echo "Test"
promoteToPublic:
create:
steps:
- name: "git"
cmd: |
set -eu
branch="internal/release-{{version}}"
git fetch origin "${branch}"
git switch "${branch}"
- name: docker(compose):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-public
sg ops update-images --registry ${registry} --kind compose --pin-tag {{tag}} docker-compose/
- name: docker(shell):tags
cmd: |
set -e
set -eu
registry=us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-public
sg ops update-images --registry ${registry} --kind shell --pin-tag {{tag}} pure-docker/
- name: "git:branch"
cmd: |
branch="promote-release_{{version}}"
set -eu
branch="promote/release-{{version}}"
git switch -c "${branch}"
git commit -am 'promote-release: {{version}}' -m '{{config}}'
git push origin "${branch}"
- name: "gh"
- name: "github:pr"
cmd: |
set -e
branch="wip_release-{{version}}"
set -eu
internal_branch="internal/release-{{version}}"
# we need to fetch from origin just in case this branch doesn't exist locally, so that the PR can find the base
git fetch origin "${branch}"
gh pr create -f -t "PRETEND PROMOTE RELEASE - release: build {{version}}" --base "${branch}" --body "Test plan: automated release PR, CI will perform additional checks"
git fetch origin "${internal_branch}"
gh pr create \
--fill \
--draft \
--base "$internal_branch" \
--title "(promote) release: 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".
finalize:
steps:
- name: git:tag
cmd: |
set -e
branch="wip_release-{{version}}"
git checkout "${branch}"
git tag wip_{{version}}
git push origin ${branch} --tags
set -eu
# Branches
internal_branch="internal/release-{{version}}"
promote_branch="promote/release-{{version}}"
release_branch="release-{{version}}"
# Create the final branch holding the tagged commit
git checkout "${promote_branch}"
git switch -c "${release_branch}"
git tag {{version}}
git push origin ${release_branch} --tags
# Web URL to the tag
tag_url="https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/{{version}}"
# Annotate PRs
cat << EOF | gh pr comment "$internal_branch" --body-file -
- :green_circle: Release has been promoted, see tag: $tag_url.
- :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
- :arrow_right: You can safely close that PR and delete its a associated branch.
EOF
cat << EOF | gh pr comment "$promote_branch" --body-file -
- :green_circle: Release has been promoted, see tag: $tag_url.
- :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
- :arrow_right: You can safely close that PR and delete its a associated branch.
EOF
# Annotate build
cat << EOF | buildkite-agent annotate --style info
Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/{{version}}).
EOF

0 comments on commit ae4d463

Please sign in to comment.