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

Validate dry-run and force flags can not be used same time in replace #110326

Merged
merged 2 commits into from Jul 8, 2022

Conversation

ardaguclu
Copy link
Member

@ardaguclu ardaguclu commented Jun 1, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR adds validation to check that dry-run and force flags
are not used at the same time. Because when force flag is set,
dry-run is discarded and objects are replaced already.

Which issue(s) this PR fixes:

Fixes kubernetes/kubectl#1222

Does this PR introduce a user-facing change?

Adds error message "dry-run can not be used when --force is set" when dry-run and force flags are set in replace command.

This PR adds validation to check that `dry-run` and `force` flags
are not used at the same time. Because when `force` flag is set,
`dry-run` is discarded and objects are replaced already.
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 1, 2022
@k8s-ci-robot k8s-ci-robot requested a review from dougsland Jun 1, 2022
@k8s-ci-robot k8s-ci-robot requested a review from KnVerey Jun 1, 2022
@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 1, 2022
@ardaguclu
Copy link
Member Author

ardaguclu commented Jun 13, 2022

@KnVerey would you mind have a look at this fix?. Thanks

@pacoxu pacoxu added this to Needs review in SIG CLI Jun 20, 2022
@seans3
Copy link
Contributor

seans3 commented Jun 29, 2022

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 29, 2022
soltysh
soltysh approved these changes Jul 7, 2022
Copy link
Contributor

@soltysh soltysh left a comment

Minor nits
/approve

staging/src/k8s.io/kubectl/pkg/cmd/replace/replace.go Outdated Show resolved Hide resolved
staging/src/k8s.io/kubectl/pkg/cmd/replace/replace.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2022
@soltysh
Copy link
Contributor

soltysh commented Jul 7, 2022

/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 7, 2022
soltysh
soltysh approved these changes Jul 7, 2022
Copy link
Contributor

@soltysh soltysh left a comment

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2022
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, soltysh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ardaguclu
Copy link
Member Author

ardaguclu commented Jul 7, 2022

/test pull-kubernetes-unit

@ardaguclu
Copy link
Member Author

ardaguclu commented Jul 7, 2022

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@k8s-triage-robot
Copy link

k8s-triage-robot commented Jul 7, 2022

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

2 similar comments
@k8s-triage-robot
Copy link

k8s-triage-robot commented Jul 7, 2022

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-triage-robot
Copy link

k8s-triage-robot commented Jul 8, 2022

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit ebcc583 into kubernetes:master Jul 8, 2022
13 of 14 checks passed
SIG CLI automation moved this from Needs review to Done Jul 8, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Jul 8, 2022
@ardaguclu ardaguclu deleted the add-validation-replace branch Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

replace --force --dry-run=server will ignore the dry-run flag
5 participants