-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Add --runbook-tag flag to run multiple runbooks by tag #576
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
base: main
Are you sure you want to change the base?
Conversation
Add --runbook-tag flag to 'runbook run' command to execute all runbooks matching specified tags
grace-rehn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM, tested locally with db and git runbooks.
hnrkndrssn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions and a question around new code path vs existing.
| if f.IsPromptEnabled() && flags.RunbookName.Value == "" && len(flags.RunbookTags.Value) == 0 { | ||
| var runBySelection string | ||
| err = f.Ask(&survey.Select{ | ||
| Message: "How do you want to run runbooks?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Message: "How do you want to run runbooks?", | |
| Message: "How do you want to select which runbook(s) to run?", |
| return nil, err | ||
| } | ||
|
|
||
| tagMap := make(map[string]bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it necessary to build this map first before populating the tag array? Wouldn't it be sufficient to build the string array directly here?
| return results | ||
| } | ||
|
|
||
| func runRunbooksByTag(cmd *cobra.Command, f factory.Factory, flags *RunFlags, octopus *octopusApiClient.Client, project *projects.Project, parsedVariables map[string]string, outputFormat string, isGit bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't follow the same path as when running a runbook by name. As a result it looks like we're missing a few optional values, most notably prompted variables.
This may cause issues for customers. Can we not implement the run by tags functionality into the existing workflow?
Summary
--runbook-tagflag to run all runbooks matching specified tags in a single command.Usage
octopus runbook run --project MyProject --runbook-tag "TagSet/Tag" --environment DevOutput
[sc-132551]