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

Change bk build pipeline argument to a flag #275

Merged
merged 6 commits into from
Jun 11, 2024
Merged

Change bk build pipeline argument to a flag #275

merged 6 commits into from
Jun 11, 2024

Conversation

jradtilbrook
Copy link
Contributor

This changes the positional pipeline argument to a flag instead. This should make more sense to users to allow specifying which pipeline to operate on within the build commands


cmd := cobra.Command{
DisableFlagsInUseLine: true,
Use: "cancel [number [pipeline]] [flags]",
Short: "Cancels a build.",
Use: "cancel <number> [flags]",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As this is a destructive operation and could cause issues when builds are cancelled whilst running, I think requiring an actual build number here is a good idea. That will mean the user won't unintentionally cancel a main branch build which could cause issues with deploys or other things.

@jradtilbrook jradtilbrook marked this pull request as ready for review June 10, 2024 03:25
Comment on lines -24 to +34
Use: "new [pipeline] [flags]",
Short: "Creates a new pipeline build",
Args: cobra.MaximumNArgs(1),
Use: "new [flags]",
Short: "Create a new build",
Args: cobra.NoArgs,
Long: heredoc.Doc(`
Creates a new build for the specified pipeline and output the URL to the build.

The pipeline can be a {pipeline_slug} or in the format {org_slug}/{pipeline_slug}.
If the pipeline argument is omitted, it will be resolved using the current directory.
Create a new build on a pipeline.
The web URL to the build will be printed to stdout.
`),
RunE: func(cmd *cobra.Command, args []string) error {
resolvers := resolver.NewAggregateResolver(
resolver.ResolveFromPositionalArgument(args, 0, f.Config),
resolver.ResolveFromFlag(pipeline, f.Config),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no build argument to this command. So I thought making the pipeline name optional instead of an arg would make sense. Any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am fine with that behaviour.

@jradtilbrook jradtilbrook enabled auto-merge (squash) June 11, 2024 00:53
@jradtilbrook jradtilbrook merged commit 154badf into 3.x Jun 11, 2024
1 check passed
@jradtilbrook jradtilbrook deleted the sup-2280 branch June 11, 2024 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants