@@ -17,11 +17,15 @@ requirements:
1717 env : DOCKER_PASSWORD
1818
1919internal :
20+ # Please keep in mind that the CI pipeline uses the branch names defined below when creating releases.
21+ # Therefore, if you update them, or if you decide to change how we detect what kind of build we're dealing
22+ # with, please update this file as well.
2023 create :
2124 steps :
2225 patch :
2326 - name : " sg ops (base)"
2427 cmd : |
28+ set -eu
2529 sg ops update-images \
2630 --kind k8s \
2731 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -31,6 +35,7 @@ internal:
3135 base/
3236 - name : " sg ops (executors)"
3337 cmd : |
38+ set -eu
3439 sg ops update-images \
3540 --kind k8s \
3641 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -40,26 +45,36 @@ internal:
4045 components/executors/
4146 - name : " git:branch"
4247 cmd : |
43- echo "Creating branch wip_{{version}}"
44- release_branch="wip_{{version}}"
45- git checkout -b $release_branch
48+ set -eu
49+ branch="internal/release-{{version}}"
50+ echo "Creating branch $branch"
51+ git checkout -b $branch
4652 - name : " git:commit"
4753 cmd : |
4854 find . -name "*.yaml" | xargs git add
4955 find . -name "*.yml" | xargs git add
56+
5057 # Careful with the quoting for the config, using double quotes will lead
5158 # to the shell dropping out all quotes from the json, leading to failed
5259 # parsing.
5360 git commit -m "release_patch: {{version}}" -m '{{config}}'
5461 - name : " git:push"
5562 cmd : |
56- git push origin wip_{{version}}
57- - name : " gh cli"
63+ branch="internal/release-{{version}}"
64+ git push origin "$branch"
65+ - name : " github:pr"
5866 cmd : |
59- gh pr create -f -t "PRETEND RELEASE WIP: release_patch: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks" # -l "wip_release"
67+ set -eu
68+ gh pr create \
69+ --fill \
70+ --draft \
71+ --title "(internal) release_patch: build {{version}}" \
72+ --body "Test plan: automated release PR, CI will perform additional checks"
73+ echo "🚢 Please check the associated CI build to ensure the process completed".
6074 minor :
6175 - name : " sg ops (base)"
6276 cmd : |
77+ set -eu
6378 sg ops update-images \
6479 --kind k8s \
6580 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -69,6 +84,7 @@ internal:
6984 base/
7085 - name : " sg ops (executors)"
7186 cmd : |
87+ set -eu
7288 sg ops update-images \
7389 --kind k8s \
7490 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -78,9 +94,10 @@ internal:
7894 components/executors/
7995 - name : " git:branch"
8096 cmd : |
81- echo "Creating branch wip_{{version}}"
82- release_branch="wip_{{version}}"
83- git checkout -b $release_branch
97+ set -eu
98+ branch="internal/release-{{version}}"
99+ echo "Creating branch $branch"
100+ git checkout -b "$branch"
84101 - name : " git:commit"
85102 cmd : |
86103 find . -name "*.yaml" | xargs git add
@@ -91,13 +108,20 @@ internal:
91108 git commit -m "release_minor: {{version}}" -m '{{config}}'
92109 - name : " git:push"
93110 cmd : |
94- git push origin wip_{{version}}
95- - name : " gh cli"
111+ branch="internal/release-{{version}}"
112+ git push origin "$branch"
113+ - name : " github:pr"
96114 cmd : |
97- gh pr create -f -t "PRETEND RELEASE WIP: release_minor: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks" # -l "wip_release"
115+ gh pr create \
116+ --fill \
117+ --draft \
118+ --title "(internal) release_minor: build {{version}}" \
119+ --body "Test plan: automated release PR, CI will perform additional checks"
120+ echo "🚢 Please check the associated CI build to ensure the process completed".
98121 major :
99122 - name : " sg ops (base)"
100123 cmd : |
124+ set -eu
101125 sg ops update-images \
102126 --kind k8s \
103127 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -107,6 +131,7 @@ internal:
107131 base/
108132 - name : " sg ops (executors)"
109133 cmd : |
134+ set -eu
110135 sg ops update-images \
111136 --kind k8s \
112137 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
@@ -116,30 +141,49 @@ internal:
116141 components/executors/
117142 - name : " git:branch"
118143 cmd : |
119- echo "Creating branch wip_{{version}}"
120- release_branch="wip_{{version}}"
121- git checkout -b $release_branch
144+ set -eu
145+ branch="internal/release-{{version}}"
146+ echo "Creating branch $branch"
147+ git checkout -b "$branch"
122148 - name : " git:commit"
123149 cmd : |
150+ set -eu
124151 find . -name "*.yaml" | xargs git add
125152 find . -name "*.yml" | xargs git add
126153 # Careful with the quoting for the config, using double quotes will lead
127154 # to the shell dropping out all quotes from the json, leading to failed
128155 # parsing.
129- git commit -m "release_patch : {{version}}" -m '{{config}}'
156+ git commit -m "release_major : {{version}}" -m '{{config}}'
130157 - name : " git:push"
131158 cmd : |
132- git push origin wip_{{version}}
133- - name : " gh cli"
159+ branch="internal/release-{{version}}"
160+ git push origin "$branch"
161+ - name : " github:pr"
134162 cmd : |
135- gh pr create -f -t "PRETEND RELEASE WIP: release_major: build {{version}}" --body "Test plan: automated release PR, CI will perform additional checks" # -l "wip_release"
163+ set -eu
164+ gh pr create \
165+ --fill \
166+ --draft \
167+ --title "(internal) release_major: build {{version}}" \
168+ --body "Test plan: automated release PR, CI will perform additional checks"
169+ echo "🚢 Please check the associated CI build to ensure the process completed".
136170 finalize :
137171 steps :
138- - name : " git "
172+ - name : " notifications "
139173 cmd : |
140- git checkout -b wip-release-{{version}}
141- git push origin wip-release-{{version}}
142- git checkout -
174+ set -eu
175+
176+ branch="internal/release-{{version}}"
177+
178+ # Post a comment on the PR.
179+ cat << EOF | gh pr comment "$branch" --body-file -
180+ - :green_circle: Internal release is ready for promotion!
181+ - :warning: Do not close/merge the pull request or delete the associated branch if you intend to promote it.
182+ EOF
183+ # Post an annotation.
184+ cat << EOF | buildkite-agent annotate --style info
185+ Internal release is ready for promotion under the branch [\`$branch\`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/$branch).
186+ EOF
143187
144188test :
145189 steps :
@@ -152,11 +196,14 @@ promoteToPublic:
152196 steps :
153197 - name : " git"
154198 cmd : |
155- echo "Checking out origin/wip-release-{{version}}"
156- git fetch origin
157- git checkout origin/wip-release-{{version}}
199+ set -eu
200+ branch="internal/release-{{version}}"
201+ echo "Checking out origin/${branch}"
202+ git fetch origin "${branch}"
203+ git switch "${branch}"
158204 - name : " sg ops"
159205 cmd : |
206+ set -eu
160207 sg ops update-images \
161208 --kind k8s \
162209 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-public \
@@ -166,6 +213,7 @@ promoteToPublic:
166213 base/
167214 - name : " sg ops (executors)"
168215 cmd : |
216+ set -eu
169217 sg ops update-images \
170218 --kind k8s \
171219 --registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-public \
@@ -175,27 +223,66 @@ promoteToPublic:
175223 components/executors/
176224 - name : " git:branch"
177225 cmd : |
178- echo "Creating branch promote-release_{{version}}"
179- branch="promote-release_ {{version}}"
180- git checkout -b $ branch
226+ set -eu
227+ branch="promote/release- {{version}}"
228+ git switch -c "${ branch}"
181229 - name : " git:commit"
182230 cmd : |
231+ set -eu
232+ branch="promote/release-{{version}}"
183233 find . -name "*.yaml" | xargs git add
184234 find . -name "*.yml" | xargs git add
235+
185236 # Careful with the quoting for the config, using double quotes will lead
186237 # to the shell dropping out all quotes from the json, leading to failed
187238 # parsing.
188- git commit -m "promote_release: {{version}}" -m '{{config}}'
189- - name : " github"
239+ git commit -am 'promote-release: {{version}}' -m '{{config}}'
240+ git push origin "${branch}"
241+ - name : " github:pr"
190242 cmd : |
191- git push origin promote-release_{{version}}
192- gh pr create -f -t "PRETEND PROMOTE RELEASE WIP: promote-release: build {{version}}" --base wip-release-{{version}} --body "Test plan: automated release PR, CI will perform additional checks"
243+ set -eu
244+ internal_branch="internal/release-{{version}}"
245+ gh pr create \
246+ --fill \
247+ --draft \
248+ --base "$internal_branch" \
249+ --title "(promote) release: build {{version}}" \
250+ --body "Test plan: automated release PR, CI will perform additional checks"
251+ echo "🚢 Please check the associated CI build to ensure the process completed".
193252 finalize :
194- # These steps should only really run once the pr created in the create step is merged
195253 steps :
196254 - name : git:tag
197255 cmd : |
198- branch="wip-release-{{version}}"
199- git checkout ${branch}
256+ set -eu
257+
258+ # Branches
259+ internal_branch="internal/release-{{version}}"
260+ promote_branch="promote/release-{{version}}"
261+ release_branch="release-{{version}}"
262+
263+ # Create the final branch holding the tagged commit
264+ git checkout "${promote_branch}"
265+ git switch -c "${release_branch}"
200266 git tag {{version}}
201- git push origin ${branch} --tags
267+ git push origin ${release_branch} --tags
268+
269+ # Web URL to the tag
270+ tag_url="https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/{{version}}"
271+
272+ # Annotate PRs
273+ cat << EOF | gh pr comment "$internal_branch" --body-file -
274+ - :green_circle: Release has been promoted, see tag: $tag_url.
275+ - :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
276+ - :arrow_right: You can safely close the PR and delete its a associated branch.
277+ EOF
278+
279+ cat << EOF | gh pr comment "$promote_branch" --body-file -
280+ - :green_circle: Release has been promoted, see tag: $tag_url.
281+ - :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
282+ - :arrow_right: You can safely close that PR and delete its a associated branch.
283+ EOF
284+
285+ # Annotate build
286+ cat << EOF | buildkite-agent annotate --style info
287+ Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/{{version}}).
288+ EOF
0 commit comments