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

⚠ pkg/cli overhaul #1828

Merged
merged 1 commit into from
Dec 4, 2020
Merged

Conversation

Adirio
Copy link
Contributor

@Adirio Adirio commented Nov 17, 2020

Description

pkg/cli: mayor overhaul
pkg/plugin: add Validate and ValidateKey helpers instead of ValidateName. The logic of this helpers was in pkg/cli/plugins.go previously.

Motivation

TODO

  • Finish tests
  • Make commands default to one that errors if no plugin provides it: this way, the cli can still be run for those commands that do not require any plugin like version.

NOTE TO REVIEWERS

Side by side comparisson of pkg/cli/cli.go and pkg/cli/cli_test.go does not provide any value. It will be easier to clone this branch and review the files locally together with the new pkg/cli/options.go and pkg/cli/options_test.go files.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 17, 2020
@Adirio
Copy link
Contributor Author

Adirio commented Nov 17, 2020

@estroz and @rashmigottipati this is the cli refactoring I told you about some days ago

@Adirio Adirio force-pushed the cli-refactoring branch 16 times, most recently from b17b1bf to 8d6a8f7 Compare November 17, 2020 14:36
@Adirio
Copy link
Contributor Author

Adirio commented Nov 17, 2020

/retest

pkg/cli/cli.go Show resolved Hide resolved
cmd/main.go Outdated Show resolved Hide resolved
@Adirio Adirio force-pushed the cli-refactoring branch 2 times, most recently from e76345b to 6bfa28c Compare November 22, 2020 15:43
pkg/plugin/interfaces.go Outdated Show resolved Hide resolved
@Adirio Adirio force-pushed the cli-refactoring branch 5 times, most recently from 8c5163c to f94d826 Compare November 23, 2020 11:31
@Adirio Adirio changed the title [WIP]⚠ pkg/cli overhaul ⚠ pkg/cli overhaul Nov 23, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 23, 2020
@Adirio
Copy link
Contributor Author

Adirio commented Nov 23, 2020

@estroz @camilamacedo86 @DirectXMan12 This PR should be ready now.

Coverage is reporting a 0.4% global reduction. However, the main files invoved have been extensively tested:

  • options.go: 100% of statements covered.
  • cli.go: 94.6% of statements covered. The only statements that are not covered are direct file system interactions (parsing the values from the read file is covered, but reading the file is not covered as there is no file to read) (6 lines) and the lines that require to execute the command in order to be covered (6 lines).

@jmrodri
Copy link
Contributor

jmrodri commented Nov 23, 2020

@Adirio

With this patch applied it works:

$ mkdir PROJECT
$ /home/jesusr/dev/kubebuilder/bin/kubebuilder version
Version: main.version{KubeBuilderVersion:"v2.3.1-391-gf260cc8e", KubernetesVendor:"unknown", GitCommit:"f260cc8ea59e64b444c4b2cf0a40da2fb61f635e", BuildDate:"2020-11-23T20:09:54Z", GoOs:"linux", GoArch:"amd64"}

Signed-off-by: Adrian Orive <adrian.orive.oneca@gmail.com>
@estroz
Copy link
Contributor

estroz commented Dec 4, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio, estroz

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2020
@Adirio
Copy link
Contributor Author

Adirio commented Dec 4, 2020

@camilamacedo86 @estroz this just needs a lgtm label to be merged

@estroz
Copy link
Contributor

estroz commented Dec 4, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2020
@estroz
Copy link
Contributor

estroz commented Dec 4, 2020

/override coverage/coveralls

1 similar comment
@pwittrock
Copy link
Contributor

/override coverage/coveralls

@pwittrock
Copy link
Contributor

Force merging this because the broken check doesn't make sense. Lets follow up with a better fix.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI: it would be helpful to skip PROJECT reads for extra commands
6 participants