Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/pro/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
flag "github.com/spf13/pflag"
)

// BindEnv re-exports pkgflags.BindEnv so pro subcommands can wire env vars
// BindEnv re-exports pkgflags.BindEnv so platform subcommands can wire env vars
// through their existing local `flags` import alias.
func BindEnv(fs *flag.FlagSet, flagName string) {
pkgflags.BindEnv(fs, flagName)
Expand Down
4 changes: 2 additions & 2 deletions cmd/pro/workspace/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (cmd *ImportCmd) importInstance(
devsyConfig *config.Config,
ref workspaceInstanceRef,
) error {
// old pro provider
// old platform provider
if !ref.provider.HasHealthCheck() {
instanceOpts, err := resolveInstanceOptions(ctx, ref.instance, ref.baseClient)
if err != nil {
Expand All @@ -201,7 +201,7 @@ func (cmd *ImportCmd) importInstance(
return nil
}

// new pro provider
// new platform provider
err := cmd.writeNewWorkspaceDefinition(devsyConfig, ref.instance, ref.provider.Name)
if err != nil {
return fmt.Errorf("prepare workspace to import definition: %w", err)
Expand Down
7 changes: 5 additions & 2 deletions pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const (
EnvDisableTelemetry = "DEVSY_DISABLE_TELEMETRY"

// EnvPlatformRunner is set by the Devsy Platform runner pod to mark runner-side CLI invocations.
EnvPlatformRunner = "DEVSY_PRO_RUNNER"
EnvPlatformRunner = "DEVSY_PLATFORM_RUNNER"

// EnvPlatformRunnerLegacy is the pre-rename runner marker still set by existing runner pods.
EnvPlatformRunnerLegacy = "DEVSY_PRO_RUNNER"

// EnvTelemetryDistinctID is set by the desktop app on spawned CLI
// processes so their events share the desktop's analytics identity.
Expand Down Expand Up @@ -171,7 +174,7 @@ const (
// EnvProviderFolder is the provider folder path passed to providers.
EnvProviderFolder = "PROVIDER_FOLDER"

// EnvProject is the Devsy project name for pro features.
// EnvProject is the Devsy project name for platform features.
EnvProject = "DEVSY_PROJECT"

// EnvFilterByOwner enables filtering by owner in Devsy.
Expand Down
11 changes: 11 additions & 0 deletions pkg/config/platform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package config

import "os"

// IsPlatformRunner reports whether the CLI runs inside a Platform runner pod; the new env var wins when set.
func IsPlatformRunner() bool {
if value := os.Getenv(EnvPlatformRunner); value != "" {
return value == BoolTrue
}
return os.Getenv(EnvPlatformRunnerLegacy) == BoolTrue
}
42 changes: 42 additions & 0 deletions pkg/config/platform_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package config

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsPlatformRunner(t *testing.T) {
tests := []struct {
name string
newValue string
legacyValue string
want bool
}{
{name: "neither set", want: false},
{name: "only new set to true", newValue: BoolTrue, want: true},
{name: "only legacy set to true", legacyValue: BoolTrue, want: true},
{name: "both set to true", newValue: BoolTrue, legacyValue: BoolTrue, want: true},
{
name: "new false wins over legacy true",
newValue: BoolFalse,
legacyValue: BoolTrue,
want: false,
},
{
name: "new true wins over legacy false",
newValue: BoolTrue,
legacyValue: BoolFalse,
want: true,
},
{name: "only legacy set to false", legacyValue: BoolFalse, want: false},
{name: "empty new falls back to legacy", newValue: "", legacyValue: BoolTrue, want: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Setenv(EnvPlatformRunner, tt.newValue)
t.Setenv(EnvPlatformRunnerLegacy, tt.legacyValue)
assert.Equal(t, tt.want, IsPlatformRunner())
})
}
}
2 changes: 1 addition & 1 deletion pkg/flags/names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const (
Version = "version"
)

// Pro / platform commands.
// Platform commands.
const (
Channel = "channel"
ChartPath = "chart-path"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ide/opener/browser_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ type browserIDEInvocation struct {
// detached background process so the CLI can return to the prompt while the
// tunnel remains running.
//
// If params.Client is a DaemonClient (pro mode) this falls back to running
// If params.Client is a DaemonClient (platform mode) this falls back to running
// the tunnel inline because the daemon already runs out-of-process.
//
// If a tunnel is already running for this workspace, no new process is
Expand Down
4 changes: 2 additions & 2 deletions pkg/telemetry/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func BootstrapCLI(cmd *cobra.Command) CLICollector {
}

isUI := os.Getenv(config.EnvUI) == config.BoolTrue
isPlatformRunner := os.Getenv(config.EnvPlatformRunner) == config.BoolTrue
isPlatformRunner := config.IsPlatformRunner()
if !isUI && !isPlatformRunner && isCIEnvironment() {
log.Debug("telemetry: disabled in CI environment")
return &noopCollector{}
Expand Down Expand Up @@ -144,7 +144,7 @@ func (d *cliCollector) RecordCLI(err error) {
}

eventType := config.BinaryName + "_cli"
if os.Getenv(config.EnvPlatformRunner) == config.BoolTrue {
if config.IsPlatformRunner() {
eventType = config.BinaryName + "_cli_runner"
}

Expand Down
Loading