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

Add new --auto-approve=if-no-changes option #754

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

julienduchesne
Copy link
Member

@julienduchesne julienduchesne commented Sep 12, 2022

Closes #743
Closes #693
It replaces the --dangerous-auto-approve option. It has three values: always, never and if-no-changes

In this PR, I also create a common structure for args that are shared between prune, delete and apply Doing so, I found two bugs:

  • Removed the --validate option on delete, it wasn't used
  • Wired in --dry-run to the prune command, it was exposed but didn't make it to kubectl

Closes #743
Closes #693
It replaces the `--dangerous-auto-approve` option. It has three values: `always`, `never` and `if-no-changes`

In this PR, I also create a common structure for args that are shared between `prune`, `delete` and `apply`
Doing so, I found two bugs:
- Removed the `--validate` option on `delete`, it wasn't used
- Wired in `--dry-run` to the `prune` command, it was exposed but didn't make it to kubectl
@julienduchesne julienduchesne marked this pull request as ready for review September 12, 2022 16:48
@julienduchesne julienduchesne requested review from sh0rez, Duologic and a team September 12, 2022 16:48
@julienduchesne julienduchesne changed the title Add new --auto-approve option Add new --auto-approve=if-no-changes option Sep 12, 2022
Copy link
Contributor

@jjo jjo left a comment

Choose a reason for hiding this comment

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

LGTM with some suggestion.

@@ -29,6 +29,28 @@ func validateDryRun(dryRunStr string) error {
return fmt.Errorf(`--dry-run must be either: "", "none", "server" or "client"`)
}

func validateAutoApprove(autoApproveDeprecated bool, autoApproveString string) (tanka.AutoApproveSetting, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would using at switch-case construct here help with streamlining the code?

@ghostsquad
Copy link

would love to see this merged

@julienduchesne julienduchesne merged commit 11cbfa1 into main Sep 13, 2022
@julienduchesne julienduchesne deleted the julienduchesne/add-new-auto-approve branch September 13, 2022 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants