Skip to content

Conversation

@HuyPhanNguyen
Copy link
Contributor

Summary

  • Adds --runbook-tag flag to run all runbooks matching specified tags in a single command.
  • Mutually exclusive with --name
  • Runs matching runbooks in parallel

Usage

octopus runbook run --project MyProject --runbook-tag "TagSet/Tag" --environment Dev

Output

  RUNBOOK          ENVIRONMENT  STATUS   TASK ID
  Runbook A        Development  Started  ServerTasks-123
  Runbook B        Development  Started  ServerTasks-124

  Successfully started: 2, Failed: 0

[sc-132551]

@HuyPhanNguyen HuyPhanNguyen requested a review from a team January 21, 2026 23:22
Copy link
Contributor

@grace-rehn grace-rehn left a 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.

Copy link
Contributor

@hnrkndrssn hnrkndrssn left a 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?",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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)
Copy link
Contributor

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 {
Copy link
Contributor

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?

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