Skip to content

Commit 9112dd4

Browse files
authored
fix(devbox): match FLYTE_DEV case-insensitively in bootstrap (#8236)
1 parent 1ce1cc6 commit 9112dd4

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ make devbox-run FLYTE_DEV=True
6464
make devbox-stop
6565
```
6666

67-
`FLYTE_DEV=True` is required when you intend to run the manager locally — it disables the in-cluster manager so your local process can take over. The value is case-sensitive: `FLYTE_DEV=true` leaves the in-cluster manager running alongside yours. `make devbox-run` writes a kubeconfig pointing at the devbox cluster in global kubeconfig, so `kubectl` will target it automatically.
67+
`FLYTE_DEV=True` is required when you intend to run the manager locally — it disables the in-cluster manager so your local process can take over. The value is case-insensitive. `make devbox-run` writes a kubeconfig pointing at the devbox cluster in global kubeconfig, so `kubectl` will target it automatically.
6868

6969
### Build and Run the Manager
7070

‎docker/devbox-bundled/bootstrap/cmd/bootstrap/main.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net"
77
"os"
88
"path/filepath"
9+
"strings"
910

1011
"github.com/flyteorg/flyte/docker/devbox-bundled/bootstrap/internal/transform"
1112
"github.com/flyteorg/flyte/docker/devbox-bundled/bootstrap/internal/transform/plugins/config"
@@ -83,11 +84,17 @@ func appleSiliconBridgeEndpoint(lookupIP func() (string, error)) (string, error)
8384
return "http://" + net.JoinHostPort(ip, port), nil
8485
}
8586

87+
// isDevMode reports whether FLYTE_DEV enables dev mode. The value is matched
88+
// case-insensitively, the same way `flyte start devbox` reads it back.
89+
func isDevMode() bool {
90+
return strings.EqualFold(os.Getenv(devModeEnvVar), "true")
91+
}
92+
8693
func main() {
8794
var tmplPath string
8895
var tPlugins []transform.Plugin
8996

90-
if os.Getenv(devModeEnvVar) == "True" {
97+
if isDevMode() {
9198
tmplPath = devTemplatePath
9299
} else {
93100
// If we are not running in dev mode, look for user-specified configuration

‎docker/devbox-bundled/bootstrap/cmd/bootstrap/main_test.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ func TestGetFirstNonLoopbackIP(t *testing.T) {
3232
assert.False(t, parsed.IsLoopback(), "should not be a loopback address")
3333
}
3434

35+
func TestIsDevMode(t *testing.T) {
36+
for _, tc := range []struct {
37+
value string
38+
want bool
39+
}{
40+
{"True", true},
41+
{"true", true},
42+
{"TRUE", true},
43+
{"False", false},
44+
{"false", false},
45+
{"", false},
46+
{"1", false},
47+
} {
48+
t.Run(tc.value, func(t *testing.T) {
49+
t.Setenv(devModeEnvVar, tc.value)
50+
assert.Equal(t, tc.want, isDevMode())
51+
})
52+
}
53+
}
54+
3555
func TestAppleSiliconBridgeEndpoint(t *testing.T) {
3656
gateway := func() (string, error) { return "192.168.65.254", nil }
3757

0 commit comments

Comments
 (0)