From d3016f6d8da81712632b4a50ab2a96cdae50a7d9 Mon Sep 17 00:00:00 2001 From: Jorge Calvar Date: Fri, 13 Feb 2026 11:57:51 +0100 Subject: [PATCH 1/2] feat: default to DEFAULT profile --- cmd/apps/init.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/apps/init.go b/cmd/apps/init.go index e815241ce9..f79994be58 100644 --- a/cmd/apps/init.go +++ b/cmd/apps/init.go @@ -808,12 +808,15 @@ func runCreate(ctx context.Context, opts createOptions) error { if err := os.Chdir(absOutputDir); err != nil { return fmt.Errorf("failed to change to project directory: %w", err) } + if profile == "" { + profile = "DEFAULT" + } } if shouldDeploy { cmdio.LogString(ctx, "") cmdio.LogString(ctx, "Deploying app...") - if err := runPostCreateDeploy(ctx); err != nil { + if err := runPostCreateDeploy(ctx, profile); err != nil { cmdio.LogString(ctx, fmt.Sprintf("⚠ Deploy failed: %v", err)) cmdio.LogString(ctx, " You can deploy manually with: databricks apps deploy") } @@ -821,7 +824,7 @@ func runCreate(ctx context.Context, opts createOptions) error { if runMode != prompt.RunModeNone { cmdio.LogString(ctx, "") - if err := runPostCreateDev(ctx, runMode, projectInitializer, absOutputDir); err != nil { + if err := runPostCreateDev(ctx, runMode, projectInitializer, absOutputDir, profile); err != nil { return err } } @@ -830,12 +833,16 @@ func runCreate(ctx context.Context, opts createOptions) error { } // runPostCreateDeploy runs the deploy command in the current directory. -func runPostCreateDeploy(ctx context.Context) error { +func runPostCreateDeploy(ctx context.Context, profile string) error { executable, err := os.Executable() if err != nil { return fmt.Errorf("failed to get executable path: %w", err) } - cmd := exec.CommandContext(ctx, executable, "apps", "deploy") + args := []string{"apps", "deploy"} + if profile != "" { + args = append(args, "--profile", profile) + } + cmd := exec.CommandContext(ctx, executable, args...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin @@ -843,7 +850,7 @@ func runPostCreateDeploy(ctx context.Context) error { } // runPostCreateDev runs the dev or dev-remote command in the current directory. -func runPostCreateDev(ctx context.Context, mode prompt.RunMode, projectInit initializer.Initializer, workDir string) error { +func runPostCreateDev(ctx context.Context, mode prompt.RunMode, projectInit initializer.Initializer, workDir, profile string) error { switch mode { case prompt.RunModeDev: if projectInit != nil { @@ -858,7 +865,11 @@ func runPostCreateDev(ctx context.Context, mode prompt.RunMode, projectInit init if err != nil { return fmt.Errorf("failed to get executable path: %w", err) } - cmd := exec.CommandContext(ctx, executable, "apps", "dev-remote") + args := []string{"apps", "dev-remote"} + if profile != "" { + args = append(args, "--profile", profile) + } + cmd := exec.CommandContext(ctx, executable, args...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin From a8880606b6696e0ad54298b7c62f5f7c6c13f31e Mon Sep 17 00:00:00 2001 From: Jorge Calvar Date: Fri, 13 Feb 2026 14:42:20 +0100 Subject: [PATCH 2/2] chore: apply PR feedback --- cmd/apps/init.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/apps/init.go b/cmd/apps/init.go index f79994be58..17ae34061c 100644 --- a/cmd/apps/init.go +++ b/cmd/apps/init.go @@ -28,6 +28,7 @@ const ( appkitRepoURL = "https://github.com/databricks/appkit" appkitTemplateDir = "template" appkitDefaultBranch = "main" + defaultProfile = "DEFAULT" ) // normalizeVersion ensures the version string has a "v" prefix if it looks like a semver. @@ -809,7 +810,8 @@ func runCreate(ctx context.Context, opts createOptions) error { return fmt.Errorf("failed to change to project directory: %w", err) } if profile == "" { - profile = "DEFAULT" + // If the profile is not set, it means the DEFAULT profile was used to infer the workspace host, we set it so that it's used for the deploy and dev-remote commands + profile = defaultProfile } } @@ -840,6 +842,7 @@ func runPostCreateDeploy(ctx context.Context, profile string) error { } args := []string{"apps", "deploy"} if profile != "" { + // We ensure the same profile is used for the deploy command as the one used for the init command args = append(args, "--profile", profile) } cmd := exec.CommandContext(ctx, executable, args...) @@ -867,6 +870,7 @@ func runPostCreateDev(ctx context.Context, mode prompt.RunMode, projectInit init } args := []string{"apps", "dev-remote"} if profile != "" { + // We ensure the same profile is used for the dev-remote command as the one used for the init command args = append(args, "--profile", profile) } cmd := exec.CommandContext(ctx, executable, args...)