Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Destroy Failed Deployments #3602

Merged
merged 6 commits into from
Aug 5, 2022
Merged

Conversation

paladin-devops
Copy link
Contributor

Update waypoint deployment destroy to continue with deleting the specified deployment from the database, while also warning the user that the resources created from the failed deployment may not be fully destroyed.

Addresses #533.

@paladin-devops paladin-devops requested a review from a team July 26, 2022 14:48
@github-actions github-actions bot added the core label Jul 26, 2022
@paladin-devops paladin-devops marked this pull request as ready for review July 26, 2022 15:12
Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on line 79/80 b/c it didn't change in this PR, but should we change this:

  }); err != nil {
    c.ui.Output("Error destroying the deployment: %s", err.Error(), terminal.WithErrorStyle())
    return ErrSentinel
  }

to simply print the error and continue destroying other deployments, instead of returning?

.changelog/3602.txt Outdated Show resolved Hide resolved
Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment/suggestion on when we should check GetState and output the UI message

internal/cli/deployment_destroy.go Show resolved Hide resolved
Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not merge this until a patch for #3601 is merged and released

}
}
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This err is now the err from line 44 and not any error returned from app.Destroy, I don't believe that is what we want.

If we plan to continue destroy attempts we probably need to collect the errors in a slice? I'm no longer sure what the intended behavior is

Copy link
Contributor Author

@paladin-devops paladin-devops Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catsby I think it'd be best to remove the error check/return here. You're right that this is actually the err from line 44, and we already catch/return that earlier (as we should).

I think collecting the errors in a slice is a good idea. After the loop is finished, we can check if there's > 0 errors in the slice, and if there are, return an error signifying that one or more destroy-ments failed. The output message will already have warned the user of which ones failed so no need to parse through the slice for anything more specific.

@paladin-devops paladin-devops merged commit 2b9ec7f into main Aug 5, 2022
@paladin-devops paladin-devops deleted the 533-incomplete-deployment-destroy branch August 5, 2022 19:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants