Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 4bca034

Browse files
authored
feat/rel: run tests + finalize steps (#61141)
* feat/rel: run tests + finalize steps * fix/ci: add missing comma in release manifest
1 parent bf7f5ec commit 4bca034

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

dev/ci/internal/ci/pipeline.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
259259
case runtype.PromoteRelease:
260260
ops = operations.NewSet(
261261
releasePromoteImages(c),
262+
wait,
263+
releaseTestOperation(c),
264+
wait,
265+
releaseFinalizeOperation(c),
262266
)
263267
default:
264268
// Executor VM image
@@ -325,6 +329,17 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
325329
// Final Bazel images
326330
publishOps.Append(bazelPushImagesFinal(c))
327331
ops.Merge(publishOps)
332+
333+
if c.RunType.Is(runtype.InternalRelease) {
334+
releaseOps := operations.NewNamedSet("Release")
335+
releaseOps.Append(
336+
wait,
337+
releaseTestOperation(c),
338+
wait,
339+
releaseFinalizeOperation(c),
340+
)
341+
ops.Merge(releaseOps)
342+
}
328343
}
329344

330345
// Construct pipeline

dev/ci/internal/ci/release_operations.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"strings"
66

77
bk "github.com/sourcegraph/sourcegraph/dev/ci/internal/buildkite"
8+
"github.com/sourcegraph/sourcegraph/dev/ci/runtype"
89

910
"github.com/sourcegraph/sourcegraph/dev/ci/images"
1011
"github.com/sourcegraph/sourcegraph/dev/ci/internal/ci/operations"
@@ -32,3 +33,50 @@ func releasePromoteImages(c Config) operations.Operation {
3233
)
3334
}
3435
}
36+
37+
// releaseTestOperations runs the script defined in release.yaml that tests the release.
38+
func releaseTestOperation(c Config) operations.Operation {
39+
return func(pipeline *bk.Pipeline) {
40+
pipeline.AddStep("Release tests",
41+
bk.Agent("queue", AspectWorkflows.QueueDefault),
42+
bk.Env("VERSION", c.Version),
43+
bk.AnnotatedCmd(
44+
bazelCmd(`run --run_under="cd $$PWD &&" //dev/sg -- release run test --branch $$BUILDKITE_BRANCH`),
45+
bk.AnnotatedCmdOpts{
46+
Annotations: &bk.AnnotationOpts{
47+
Type: bk.AnnotationTypeInfo,
48+
IncludeNames: true,
49+
},
50+
},
51+
))
52+
}
53+
}
54+
55+
// releaseFinalizeOperation runs the script defined in release.yaml that finalizes the release. It picks
56+
// the variant (internal or public) based on the run type.
57+
//
58+
// Important: this helper doesn't inject the `wait` step, it's on the calling side to handle that. This is
59+
// necessary because by definition, you want to call finalize only when everything else succeeded.
60+
func releaseFinalizeOperation(c Config) operations.Operation {
61+
label := "Finalize internal release"
62+
command := "internal"
63+
if c.RunType.Is(runtype.PromoteRelease) {
64+
label = "Final release promotion"
65+
command = "promote-to-public"
66+
}
67+
68+
return func(pipeline *bk.Pipeline) {
69+
pipeline.AddStep(label,
70+
bk.Agent("queue", AspectWorkflows.QueueDefault),
71+
bk.Env("VERSION", c.Version),
72+
bk.AnnotatedCmd(
73+
bazelCmd(fmt.Sprintf(`run --run_under="cd $$PWD &&" //dev/sg -- release run %s finalize --branch $$BUILDKITE_BRANCH`, command)),
74+
bk.AnnotatedCmdOpts{
75+
Annotations: &bk.AnnotationOpts{
76+
Type: bk.AnnotationTypeInfo,
77+
IncludeNames: true,
78+
},
79+
},
80+
))
81+
}
82+
}

release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ promoteToPublic:
6363
"branch": "{{git.branch}}",
6464
"message": "Promoting internal release {{version}} to public",
6565
"env": {
66-
"DISABLE_ASPECT_WORKFLOWS": "true"
66+
"DISABLE_ASPECT_WORKFLOWS": "true",
6767
"RELEASE_PUBLIC": "true",
6868
"VERSION": "{{tag}}"
6969
}

0 commit comments

Comments
 (0)