Skip to content

Introduce azdo pipelines build tag command group #276

@tmeckel

Description

@tmeckel

Introduce the azdo pipelines build tag subgroup beneath azdo pipelines build (#213). This umbrella tracks the wiring of the subgroup and lists the three leaf commands that operate on build tags.

Command Group Description

Create a tag subgroup beneath azdo pipelines build that centralises tag-management flows for a single Azure Pipelines build. The group exposes the three Azure Pipelines build-tag operations that map directly to the official AzDO Extension's pipelines build tag group (Python implementation at azure-devops/azext_devops/dev/pipelines/build.py):

Each leaf is a thin wrapper over the vendored build.Client (singular AddBuildTag, bulk AddBuildTags, DeleteBuildTag, GetBuildTags). The REST surface is Builds - Tags (REST 7.1-preview.3).

Note: this group is distinct from the pipelines build definition subgroup (planned but not yet filed) which manages tags on a build definition (uses AddDefinitionTag / DeleteDefinitionTag). Tags on a build record are immutable once recorded; tags on a definition are persisted and can be inherited by builds.

Implementation Notes

  • Add internal/cmd/pipelines/build/tag/tag.go that exposes NewCmd(ctx util.CmdContext) *cobra.Command.
  • Register the new subgroup inside internal/cmd/pipelines/build/build.go so that commands such as azdo pipelines build tag list are discoverable via the CLI hierarchy. The existing umbrella feat: Introduce azdo pipelines build command group #213 already lists list, show, cancel, queue as children of build; this umbrella appends tag as a new child group.
  • Keep the short description focused on per-build tag management; do not duplicate descriptions of the parent build group.
  • The Python implementation only accepts a single positional build ID; in our Go port the build ID lives in the third segment of the [ORGANIZATION/]PROJECT/BUILD positional, mirroring cancel (feat: Implement azdo pipelines build cancel command #252) and queue (feat: Implement azdo pipelines build queue command #253).
  • Each leaf command lives in its own subdirectory under internal/cmd/pipelines/build/tag/<leaf>/<leaf>.go per AGENTS.md "New Subgroup Under Existing Group" guidance.
  • No new SDK clients are required: AddBuildTag, AddBuildTags, DeleteBuildTag, and GetBuildTags are all in the vendored SDK at vendor/.../v7/build/client.go:29, 31, 51, 111. Mocks are already generated at internal/mocks/build_client_mock.go:46, 61, 210.

Command Wiring

  • Implement the relation group in internal/cmd/pipelines/build/tag/tag.go and ensure NewCmd only wires child commands under this package.
  • Update internal/cmd/pipelines/build/build.go to call cmd.AddCommand(tag.NewCmd(ctx)) so the build hierarchy exposes the tag subtree.
  • Each leaf exports NewCmd(ctx util.CmdContext) *cobra.Command from its own subdirectory.
  • Run make docs once wiring is complete to update generated documentation.

SDK / Client Requirements

  • All three leaves rely on the Build client via ClientFactory().Build(...).
  • No new client methods are required.
  • No new mocks are required (all four are already generated).

Tooling & Validation

  • Format new Go code with gofmt/goimports.
  • Run go build ./cmd/azdo/... to ensure the CLI compiles with the new wiring.
  • Add/update hermetic tests and execute go test ./... (include documentation regeneration in the validation checklist).

Sub-Issues

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions