Skip to content

Commit c20559d

Browse files
authored
Fix nil pointer dereference in WaitForDeploymentToComplete (#4993)
## Changes - Fix nil pointer dereference in `WaitForDeploymentToComplete` when the app deployment `Status` field is nil. Add nil checks before accessing `Status.State` for both active and pending deployments. ## Why If the API returns a deployment object before its status is populated, the CLI panics with a nil pointer dereference during `bundle deploy`.
1 parent 64a5907 commit c20559d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

bundle/appdeploy/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func BuildDeployment(sourcePath string, config *resources.AppConfig, gitSource *
4949
// WaitForDeploymentToComplete waits for active and pending deployments on an app to finish.
5050
func WaitForDeploymentToComplete(ctx context.Context, w *databricks.WorkspaceClient, app *sdkapps.App) error {
5151
if app.ActiveDeployment != nil &&
52+
app.ActiveDeployment.Status != nil &&
5253
app.ActiveDeployment.Status.State == sdkapps.AppDeploymentStateInProgress {
5354
logProgress(ctx, "Waiting for the active deployment to complete...")
5455
_, err := w.Apps.WaitGetDeploymentAppSucceeded(ctx, app.Name, app.ActiveDeployment.DeploymentId, 20*time.Minute, nil)
@@ -59,6 +60,7 @@ func WaitForDeploymentToComplete(ctx context.Context, w *databricks.WorkspaceCli
5960
}
6061

6162
if app.PendingDeployment != nil &&
63+
app.PendingDeployment.Status != nil &&
6264
app.PendingDeployment.Status.State == sdkapps.AppDeploymentStateInProgress {
6365
logProgress(ctx, "Waiting for the pending deployment to complete...")
6466
_, err := w.Apps.WaitGetDeploymentAppSucceeded(ctx, app.Name, app.PendingDeployment.DeploymentId, 20*time.Minute, nil)

0 commit comments

Comments
 (0)