Skip to content

Commit 42e7b46

Browse files
authored
Merge pull request #3658 from buildkite/ming/ps-1525
PS-1525: keep BUILDKITE_KUBERNETES_EXEC true for k8s bootstrap
2 parents e9435e0 + 630dfd0 commit 42e7b46

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

clicommand/agent_start.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,18 @@ var AgentStartCommand = cli.Command{
747747
DebugHTTPFlag,
748748
TraceHTTPFlag,
749749

750+
// Kubernetes
751+
cli.BoolFlag{
752+
Name: "kubernetes-exec",
753+
Usage: "This is intended to be used only by the Buildkite k8s stack " +
754+
"(github.com/buildkite/agent-stack-k8s); it enables a Unix socket for transporting " +
755+
"logs and exit statuses between containers in a pod",
756+
EnvVar: "BUILDKITE_KUBERNETES_EXEC",
757+
},
758+
750759
// Other shared flags
751760
RedactedVars,
752761
StrictSingleHooksFlag,
753-
KubernetesExecFlag,
754762
TraceContextEncodingFlag,
755763
NoMultipartArtifactUploadFlag,
756764

clicommand/global.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,6 @@ var (
100100
EnvVar: "BUILDKITE_SOCKETS_PATH",
101101
}
102102

103-
KubernetesExecFlag = cli.BoolFlag{
104-
Name: "kubernetes-exec",
105-
Usage: "This is intended to be used only by the Buildkite k8s stack " +
106-
"(github.com/buildkite/agent-stack-k8s); it enables a Unix socket for transporting " +
107-
"logs and exit statuses between containers in a pod",
108-
EnvVar: "BUILDKITE_KUBERNETES_EXEC",
109-
}
110-
111103
KubernetesContainerIDFlag = cli.IntFlag{
112104
Name: "kubernetes-container-id",
113105
Usage: "This is intended to be used only by the Buildkite k8s stack " +

clicommand/kubernetes_bootstrap.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ var KubernetesBootstrapCommand = cli.Command{
123123
return err
124124
}
125125

126-
// Ensure the Kubernetes socket setup is disabled in the subprocess
127-
// (we're doing all that here).
128-
environ.Set("BUILDKITE_KUBERNETES_EXEC", "false")
126+
// BUILDKITE_KUBERNETES_EXEC is a legacy environment variable. It was used to activate the socket
127+
// on the bootstrap command, and to activate the socket server on `buildkite-agent start`.
128+
// The former has been superseded by this `kubernetes-bootstrap` command.
129+
// We keep this env var because some users depend on it as a k8s environment detection mechanism.
130+
environ.Set("BUILDKITE_KUBERNETES_EXEC", "true")
129131

130132
if _, exists := environ.Get("BUILDKITE_BUILD_CHECKOUT_PATH"); !exists {
131133
// The OG agent runs as a long-live worker, therefore it set a checkout path dynamically to cater

0 commit comments

Comments
 (0)