Skip to content

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.

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
@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