Skip to content

Commit 7539134

Browse files
authored
Set PREFLIGHT env var on preflight builds, keep BUILDKITE_PREFLIGHT as deprecated (#761)
Preflight builds now set PREFLIGHT=true as the canonical env var. BUILDKITE_PREFLIGHT=true is kept for backwards compatibility but marked as deprecated, giving consumers time to migrate.
1 parent 58c59ff commit 7539134

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/preflight/preflight.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func (c *PreflightCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error
120120
Commit: result.Commit,
121121
Branch: result.Branch,
122122
Env: map[string]string{
123-
"BUILDKITE_PREFLIGHT": "true",
123+
"PREFLIGHT": "true",
124+
"BUILDKITE_PREFLIGHT": "true", // deprecated
124125
},
125126
})
126127
if err != nil {

cmd/preflight/preflight_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ func TestPreflightCmd_Run(t *testing.T) {
122122
if !strings.HasPrefix(gotReq.Message, "Preflight ") {
123123
t.Errorf("expected message starting with 'Preflight ', got %q", gotReq.Message)
124124
}
125+
if gotReq.Env["PREFLIGHT"] != "true" {
126+
t.Errorf("expected PREFLIGHT=true, got %#v", gotReq.Env)
127+
}
125128
if gotReq.Env["BUILDKITE_PREFLIGHT"] != "true" {
126-
t.Errorf("expected BUILDKITE_PREFLIGHT=true, got %#v", gotReq.Env)
129+
t.Errorf("expected BUILDKITE_PREFLIGHT=true (deprecated), got %#v", gotReq.Env)
127130
}
128131
})
129132

0 commit comments

Comments
 (0)