From ce3078bb3ba69c46708377fc49a3750fb6e756ba Mon Sep 17 00:00:00 2001 From: David Bond Date: Wed, 11 Oct 2023 13:30:54 +0100 Subject: [PATCH] Rework deployment logic This commit modifies the logic used by the `digitalocean_app` resource to check each step for a success status rather than using the counts of steps. The step counting method fails to work with jobs of kind `FAILED_DEPLOY` as these will always be pending, meaning that any app deployed with a job of this type will always time out even when it is successful. Closes #1047 Signed-off-by: David Bond --- digitalocean/app/resource_app.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/digitalocean/app/resource_app.go b/digitalocean/app/resource_app.go index 09e6decbb..426db0e1d 100644 --- a/digitalocean/app/resource_app.go +++ b/digitalocean/app/resource_app.go @@ -221,7 +221,14 @@ func waitForAppDeployment(client *godo.Client, id string, timeout time.Duration) return fmt.Errorf("Error trying to read app deployment state: %s", err) } - allSuccessful := deployment.Progress.SuccessSteps == deployment.Progress.TotalSteps + allSuccessful := true + for _, step := range deployment.Progress.Steps { + if step.Status != godo.DeploymentProgressStepStatus_Success { + allSuccessful = false + break + } + } + if allSuccessful { ticker.Stop() return nil