Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(COR-842): allow to force cancel deployment #316

Merged
Merged
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
8 changes: 4 additions & 4 deletions cmd/environment_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/spf13/cobra"
)

var forceCancel bool

var environmentCancelCmd = &cobra.Command{
Use: "cancel",
Short: "Cancel an environment deployment",
Expand All @@ -24,17 +26,14 @@ var environmentCancelCmd = &cobra.Command{

client := utils.GetQoveryClient(tokenType, token)
_, _, envId, err := getOrganizationProjectEnvironmentContextResourcesIds(client)

if err != nil {
utils.PrintlnError(err)
os.Exit(1)
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

_, _, err = client.EnvironmentActionsAPI.CancelEnvironmentDeployment(context.Background(), envId).Execute()

_, _, err = client.EnvironmentActionsAPI.CancelEnvironmentDeployment(context.Background(), envId).CancelEnvironmentDeploymentRequest(qovery.CancelEnvironmentDeploymentRequest{ForceCancel: &forceCancel}).Execute()
if err != nil {
utils.PrintlnError(err)
os.Exit(1)
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}
Expand All @@ -52,5 +51,6 @@ func init() {
environmentCancelCmd.Flags().StringVarP(&organizationName, "organization", "", "", "Organization Name")
environmentCancelCmd.Flags().StringVarP(&projectName, "project", "", "", "Project Name")
environmentCancelCmd.Flags().StringVarP(&environmentName, "environment", "", "", "Environment Name")
environmentCancelCmd.Flags().BoolVarP(&forceCancel, "force", "f", false, "Force cancel")
environmentCancelCmd.Flags().BoolVarP(&watchFlag, "watch", "w", false, "Watch environment status until it's ready or an error occurs")
}
Loading