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: (go/v4): ensure --make=false option is available for webhook creation for consistency #4275

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
14 changes: 11 additions & 3 deletions pkg/plugins/golang/v4/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ type createWebhookSubcommand struct {
// Deprecated - TODO: remove it for go/v5
// isLegacyPath indicates that the resource should be created in the legacy path under the api
isLegacyPath bool

// runMake indicates whether to run make or not after scaffolding APIs
runMake bool
}

func (p *createWebhookSubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) {
Expand All @@ -69,6 +72,8 @@ validating and/or conversion webhooks.
func (p *createWebhookSubcommand) BindFlags(fs *pflag.FlagSet) {
p.options = &goPlugin.Options{}

fs.BoolVar(&p.runMake, "make", true, "if true, run `make generate` after generating files")

fs.StringVar(&p.options.Plural, "plural", "", "resource irregular plural form")

fs.BoolVar(&p.options.DoDefaulting, "defaulting", false,
Expand Down Expand Up @@ -145,10 +150,13 @@ func (p *createWebhookSubcommand) PostScaffold() error {
return err
}

err = pluginutil.RunCmd("Running make", "make", "generate")
if err != nil {
return err
if p.runMake {
err = pluginutil.RunCmd("Running make", "make", "generate")
if err != nil {
return err
}
}

fmt.Print("Next: implement your new Webhook and generate the manifests with:\n$ make manifests\n")

return nil
Expand Down
Loading