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

Exit with a success code instead of a panic when change set includes no change. #84

Merged
merged 3 commits into from
Apr 1, 2022
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
10 changes: 9 additions & 1 deletion internal/cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/spf13/cobra"
)

const noChangeFoundMsg = "The submitted information didn't contain changes. Submit different information to create a change set."

type configFileFormat struct {
Parameters map[string]string `yaml:"Parameters"`
Tags map[string]string `yaml:"Tags"`
Expand Down Expand Up @@ -159,7 +161,13 @@ YAML:
spinner.Push("Creating change set")
changeSetName, createErr := cfn.CreateChangeSet(template, parameters, combinedTags, stackName, roleArn)
if createErr != nil {
panic(ui.Errorf(createErr, "error creating changeset"))
if createErr.Error() == noChangeFoundMsg {
spinner.Pop()
fmt.Println(console.Green("Change set was created, but there is no change. Deploy was skipped."))
return
} else {
panic(ui.Errorf(createErr, "error creating changeset"))
}
}

changeSetStatus, err := cfn.GetChangeSet(stackName, changeSetName)
Expand Down