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

Implement bk pipeline create #274

Merged
merged 4 commits into from
Jun 11, 2024
Merged

Implement bk pipeline create #274

merged 4 commits into from
Jun 11, 2024

Conversation

lizrabuya
Copy link
Contributor

@lizrabuya lizrabuya commented Jun 6, 2024

bk pipeline create command prompts for a pipeline name and description, then tries to resolve a git repo URL in its directory path. If no repo URL is resolved, it will prompt for a repo URL.

@lizrabuya lizrabuya marked this pull request as ready for review June 11, 2024 00:14
@jradtilbrook jradtilbrook force-pushed the sup-157-bk-pipeline-create branch from 3774338 to 974bc03 Compare June 11, 2024 00:59
RunE: func(cmd *cobra.Command, args []string) error {
var repoURL string

qs := []*survey.Question{
Copy link
Contributor

Choose a reason for hiding this comment

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

The survey package we are using was deprecated in April!! 😢

We can keep using it for now and follow up with replacing it. On the readme it says to use bubbletea 😆

One cool thing we'll be able to do with that is use the huh package hide feature. That will gracefully allow us to accept flags or arguments to this command and build up a form to get the other fields from the user.

pkg/cmd/pipeline/create.go Outdated Show resolved Hide resolved
pkg/cmd/pipeline/create.go Outdated Show resolved Hide resolved
Comment on lines +51 to +64
if len(repoURLS) > 0 {
prompt := &survey.Select{
Message: "Choose a repository:",
Options: repoURLS,
}
err := survey.AskOne(prompt, &repoURL, survey.WithValidator(survey.Required))
if err != nil {
return err
}
} else {
err := survey.AskOne(&survey.Input{Message: "Repository URL:"}, &repoURL, survey.WithValidator(survey.Required))
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be wrapped into line 45 so its all done at once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not find an option that would prompt if the options provided is empty. But maybe there is a way with bubbletea.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah it probably doesn't exist in this package. Something we can move to with bubbletea in the future maybe 👍

lizrabuya and others added 2 commits June 11, 2024 11:20
Co-authored-by: Jarryd Tilbrook <jarryd@buildkite.com>
@jradtilbrook jradtilbrook enabled auto-merge (squash) June 11, 2024 01:40
@jradtilbrook jradtilbrook merged commit 584134e into 3.x Jun 11, 2024
1 check passed
@jradtilbrook jradtilbrook deleted the sup-157-bk-pipeline-create branch June 11, 2024 02:52
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.

3 participants