Skip to content

Commit d18c748

Browse files
authored
update release manifest (sourcegraph#4307)
* update release manifest the following branches get created: - internal release: internal/release-vX.Y.Z - promote to public - promote/release-vX.Y.Z - release/vX.Y.Z <--- The tag for the release will live on this branch * update pipeline for release process * update branch names for qa * fix find expressions * add github cli to tool-versions
1 parent b690b60 commit d18c748

File tree

3 files changed

+148
-53
lines changed

3 files changed

+148
-53
lines changed

.buildkite/pipeline.yaml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ steps:
6060
command: .buildkite/cleanup-disks.sh
6161
agents: { queue: standard }
6262

63+
# Please keep in mind that the release manifest uses specific branch names when creating releases.
64+
# Therefore, if you update them, or if you decide to change how we detect what kind of build we're dealing
65+
# with, please update this file as well.
66+
- label: "(internal) Release: test"
67+
if: build.branch =~ /^internal\/release-.*/
68+
plugins:
69+
- ssh://[email protected]/sourcegraph/sg-buildkite-plugin.git#main: ~
70+
command: |
71+
sg release run test --workdir=. --config-from-commit
72+
73+
- label: "(promote) Release: test"
74+
if: build.branch =~ /^promote\/release-.*/
75+
plugins:
76+
- ssh://[email protected]/sourcegraph/sg-buildkite-plugin.git#main: ~
77+
command: |
78+
sg release run test --workdir=. --config-from-commit
79+
6380
- label: "Release: test"
6481
if: "build.branch =~ /^wip_/"
6582
plugins:
@@ -69,14 +86,15 @@ steps:
6986
7087
- wait
7188

72-
- label: "Release: finalize"
73-
if: "build.branch =~ /^wip_/"
89+
- label: "(internal) Release: finalize"
90+
if: build.branch =~ /^internal\/release-.*/
7491
plugins:
7592
- ssh://[email protected]/sourcegraph/sg-buildkite-plugin.git#main: ~
7693
command: |
7794
sg release run internal finalize --workdir=. --config-from-commit
78-
- label: "Promote to public: finalize"
79-
if: build.message =~ /^promote_release/ && build.branch =~ /^wip-release/
95+
96+
- label: "(promote) Release: finalize"
97+
if: build.branch =~ /^promote\/release-.*/
8098
plugins:
8199
- ssh://[email protected]/sourcegraph/sg-buildkite-plugin.git#main: ~
82100
command: |

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ kustomize 4.5.7
66
shfmt 3.1.0
77
nodejs 20.8.1
88
python system
9+
github-cli 2.46.0

release.yaml

Lines changed: 125 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal:
3131
base/
3232
- name: "sg ops (overlays)"
3333
cmd: |
34-
folders=$(find overlays -type d -d 1 \! -name "low-resource")
34+
folders=$(find overlays -maxdepth 1 overlays -type d \! -name "low-resource")
3535
3636
for path in $folders; do
3737
echo "updating ${path}"
@@ -45,7 +45,7 @@ internal:
4545
done
4646
- name: "sg ops (configure)"
4747
cmd: |
48-
folders=$(find configure -type d -d 1)
48+
folders=$(find configure -maxdepth 1 -type d)
4949
5050
for path in $folders; do
5151
echo "updating ${path}"
@@ -59,23 +59,32 @@ internal:
5959
done
6060
- name: "git:branch"
6161
cmd: |
62-
echo "Creating branch wip_{{version}}"
63-
release_branch="wip_{{version}}"
64-
git checkout -b $release_branch
62+
set -eu
63+
branch="internal/release-{{version}}"
64+
echo "Creating branch $branch"
65+
git checkout -b $branch
6566
- name: "git:commit"
6667
cmd: |
6768
find . -name "*.yaml" | xargs git add
6869
find . -name "*.yml" | xargs git add
70+
6971
# Careful with the quoting for the config, using double quotes will lead
7072
# to the shell dropping out all quotes from the json, leading to failed
7173
# parsing.
7274
git commit -m "release_patch: {{version}}" -m '{{config}}'
7375
- name: "git:push"
7476
cmd: |
75-
git push origin wip_{{version}}
76-
- name: "gh cli"
77+
branch="internal/release-{{version}}"
78+
git push origin "$branch"
79+
- name: "github:pr"
7780
cmd: |
78-
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"
81+
set -eu
82+
gh pr create \
83+
--fill \
84+
--draft \
85+
--title "(internal) release_patch: build {{version}}" \
86+
--body "Test plan: automated release PR, CI will perform additional checks"
87+
echo "🚢 Please check the associated CI build to ensure the process completed".
7988
minor:
8089
- name: "sg ops (base)"
8190
cmd: |
@@ -88,7 +97,7 @@ internal:
8897
base/
8998
- name: "sg ops (overlays)"
9099
cmd: |
91-
folders=$(find overlays -type d -d 1 \! -name "low-resource")
100+
folders=$(find overlays -maxdepth 1 -type d \! -name "low-resource")
92101
93102
for path in $folders; do
94103
echo "updating ${path}"
@@ -102,7 +111,7 @@ internal:
102111
done
103112
- name: "sg ops (configure)"
104113
cmd: |
105-
folders=$(find configure -type d -d 1)
114+
folders=$(find configure -maxdepth 1 -type d)
106115
107116
for path in $folders; do
108117
echo "updating ${path}"
@@ -116,23 +125,32 @@ internal:
116125
done
117126
- name: "git:branch"
118127
cmd: |
119-
echo "Creating branch wip_{{version}}"
120-
release_branch="wip_{{version}}"
121-
git checkout -b $release_branch
128+
set -eu
129+
branch="internal/release-{{version}}"
130+
echo "Creating branch $branch"
131+
git checkout -b $branch
122132
- name: "git:commit"
123133
cmd: |
124134
find . -name "*.yaml" | xargs git add
125135
find . -name "*.yml" | xargs git add
136+
126137
# Careful with the quoting for the config, using double quotes will lead
127138
# to the shell dropping out all quotes from the json, leading to failed
128139
# parsing.
129140
git commit -m "release_minor: {{version}}" -m '{{config}}'
130141
- name: "git:push"
131142
cmd: |
132-
git push origin wip_{{version}}
133-
- name: "gh cli"
143+
branch="internal/release-{{version}}"
144+
git push origin "$branch"
145+
- name: "github:pr"
134146
cmd: |
135-
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"
147+
set -eu
148+
gh pr create \
149+
--fill \
150+
--draft \
151+
--title "(internal) release_patch: build {{version}}" \
152+
--body "Test plan: automated release PR, CI will perform additional checks"
153+
echo "🚢 Please check the associated CI build to ensure the process completed".
136154
major:
137155
- name: "sg ops (base)"
138156
cmd: |
@@ -145,7 +163,7 @@ internal:
145163
base/
146164
- name: "sg ops (overlays)"
147165
cmd: |
148-
folders=$(find overlays -type d -d 1 \! -name "low-resource")
166+
folders=$(find overlays -maxdepth 1 -type d \! -name "low-resource")
149167
150168
for path in $folders; do
151169
echo "updating ${path}"
@@ -159,7 +177,7 @@ internal:
159177
done
160178
- name: "sg ops (configure)"
161179
cmd: |
162-
folders=$(find configure -type d -d 1)
180+
folders=$(find configure -maxdepth 1 -type d)
163181
164182
for path in $folders; do
165183
echo "updating ${path}"
@@ -173,31 +191,49 @@ internal:
173191
done
174192
- name: "git:branch"
175193
cmd: |
176-
echo "Creating branch wip_{{version}}"
177-
release_branch="wip_{{version}}"
178-
git checkout -b $release_branch
194+
set -eu
195+
branch="internal/release-{{version}}"
196+
echo "Creating branch $branch"
197+
git checkout -b $branch
179198
- name: "git:commit"
180199
cmd: |
181200
find . -name "*.yaml" | xargs git add
182201
find . -name "*.yml" | xargs git add
202+
183203
# Careful with the quoting for the config, using double quotes will lead
184204
# to the shell dropping out all quotes from the json, leading to failed
185205
# parsing.
186-
git commit -m "release_patch: {{version}}" -m '{{config}}'
206+
git commit -m "release_major: {{version}}" -m '{{config}}'
187207
- name: "git:push"
188208
cmd: |
189-
git push origin wip_{{version}}
190-
- name: "gh cli"
209+
branch="internal/release-{{version}}"
210+
git push origin "$branch"
211+
- name: "github:pr"
191212
cmd: |
192-
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"
213+
set -eu
214+
gh pr create \
215+
--fill \
216+
--draft \
217+
--title "(internal) release_patch: build {{version}}" \
218+
--body "Test plan: automated release PR, CI will perform additional checks"
219+
echo "🚢 Please check the associated CI build to ensure the process completed".
193220
finalize:
194221
steps:
195-
- name: "git"
222+
- name: "notifications"
196223
cmd: |
197-
set -e
198-
git checkout -b wip-release-{{version}}
199-
git push origin wip-release-{{version}}
200-
git checkout -
224+
set -eu
225+
226+
branch="internal/release-{{version}}"
227+
228+
# Post a comment on the PR.
229+
cat << EOF | gh pr comment "$branch" --body-file -
230+
- :green_circle: Internal release is ready for promotion!
231+
- :warning: Do not close/merge the pull request or delete the associated branch if you intend to promote it.
232+
EOF
233+
# Post an annotation.
234+
cat << EOF | buildkite-agent annotate --style info
235+
Internal release is ready for promotion under the branch [\`$branch\`](https://github.com/sourcegraph/deploy-sourcegraph/tree/$branch).
236+
EOF
201237
202238
test:
203239
steps:
@@ -210,21 +246,23 @@ promoteToPublic:
210246
steps:
211247
- name: "git"
212248
cmd: |
213-
echo "Checking out origin/wip-release-{{version}}"
214-
git fetch origin
215-
git checkout origin/wip-release-{{version}}
249+
set -eu
250+
branch="internal/release-{{version}}"
251+
echo "Checking out origin/${branch}"
252+
git fetch origin "${branch}"
253+
git switch "${branch}"
216254
- name: "sg ops (base)"
217255
cmd: |
218256
sg ops update-images \
219257
--kind k8s \
220-
--registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-internal \
258+
--registry us-central1-docker.pkg.dev/sourcegraph-ci/rfc795-public \
221259
--docker-username=$DOCKER_USERNAME \
222260
--docker-password=$DOCKER_PASSWORD \
223261
--pin-tag {{inputs.server.tag}} \
224262
base/
225263
- name: "sg ops (overlays)"
226264
cmd: |
227-
folders=$(find overlays -type d -d 1 \! -name "low-resource")
265+
folders=$(find overlays -maxdepth 1 -type d \! -name "low-resource")
228266
229267
for path in $folders; do
230268
echo "updating ${path}"
@@ -238,7 +276,7 @@ promoteToPublic:
238276
done
239277
- name: "sg ops (configure)"
240278
cmd: |
241-
folders=$(find configure -type d -d 1)
279+
folders=$(find configure -maxdepth 1 -type d )
242280
243281
for path in $folders; do
244282
echo "updating ${path}"
@@ -252,29 +290,67 @@ promoteToPublic:
252290
done
253291
- name: "git:branch"
254292
cmd: |
255-
echo "Creating branch promote-release_{{version}}"
256-
branch="promote-release_{{version}}"
257-
git checkout -b $branch
293+
set -eu
294+
branch="promote/release-{{version}}"
295+
git switch -c "${branch}"
258296
- name: "git:commit"
259297
cmd: |
298+
set -eu
299+
branch="promote/release-{{version}}"
260300
find . -name "*.yaml" | xargs git add
261301
find . -name "*.yml" | xargs git add
302+
262303
# Careful with the quoting for the config, using double quotes will lead
263304
# to the shell dropping out all quotes from the json, leading to failed
264305
# parsing.
265-
git commit -m "promote_release: {{version}}" -m '{{config}}'
266-
- name: "github"
306+
git commit -am 'promote-release: {{version}}' -m '{{config}}'
307+
git push origin "${branch}"
308+
- name: "github:pr"
267309
cmd: |
268-
set -e
269-
git push origin promote-release_{{version}}
270-
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"
310+
set -eu
311+
internal_branch="internal/release-{{version}}"
312+
gh pr create \
313+
--fill \
314+
--draft \
315+
--base "$internal_branch" \
316+
--title "(promote) release: build {{version}}" \
317+
--body "Test plan: automated release PR, CI will perform additional checks"
318+
echo "🚢 Please check the associated CI build to ensure the process completed".
271319
finalize:
272320
# These steps should only really run once the pr created in the create step is merged
273321
steps:
274322
- name: git:tag
275323
cmd: |
276-
set -e
277-
branch="wip-release-{{version}}"
278-
git checkout ${branch}
279-
git tag {{version}}
280-
git push origin ${branch} --tags
324+
set -eu
325+
326+
# Branches
327+
internal_branch="internal/release-{{version}}"
328+
promote_branch="promote/release-{{version}}"
329+
release_branch="qa-release-{{version}}"
330+
331+
# Create the final branch holding the tagged commit
332+
git checkout "${promote_branch}"
333+
git switch -c "${release_branch}"
334+
git tag qa-{{version}}
335+
git push origin ${release_branch} --tags
336+
337+
# Web URL to the tag
338+
tag_url="https://github.com/sourcegraph/deploy-sourcegraph/tree/{{version}}"
339+
340+
# Annotate PRs
341+
cat << EOF | gh pr comment "$internal_branch" --body-file -
342+
- :green_circle: Release has been promoted, see tag: $tag_url.
343+
- :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
344+
- :arrow_right: You can safely close the PR and delete its a associated branch.
345+
EOF
346+
347+
cat << EOF | gh pr comment "$promote_branch" --body-file -
348+
- :green_circle: Release has been promoted, see tag: $tag_url.
349+
- :no_entry: Do not under any circumstance delete the branch holding the tagged commit (i.e. \`$release_branch\`).
350+
- :arrow_right: You can safely close that PR and delete its a associated branch.
351+
EOF
352+
353+
# Annotate build
354+
cat << EOF | buildkite-agent annotate --style info
355+
Promoted release is **publicly available** through a git tag at [\`{{version}}\`](https://github.com/sourcegraph/deploy-sourcegraph/tree/{{version}}).
356+
EOF

0 commit comments

Comments
 (0)