Skip to content

feat: Implement azdo pipelines variable-group delete command #123

@tmeckel

Description

@tmeckel

This issue tracks the implementation of the azdo pipelines variable-group delete command.

Command Description

Delete a variable group from a project. The Azure CLI issues TaskAgentClient.delete_variable_group and prints a success message (source). azdo should provide the same capability with confirmation prompts, consistent output handling, and the shared resolver used by the other variable-group commands.

azdo Command Signature

azdo pipelines variable-group delete [ORGANIZATION/]PROJECT/VARIABLE_GROUP_ID_OR_NAME [--yes]

Flags:

  • --yes, -y: Skip the confirmation prompt.
  • JSON export flags registering deleted and groupId so automation can detect successful deletions via --json.

Behavior

  • Resolve scope and the target group identifier using the shared helper (numeric ID or case-insensitive name lookup with collision checks).
  • Start the progress indicator.
  • If --yes is not provided, prompt the user (Delete variable group <name>?). Return util.ErrCancel when declined.
  • Call client.DeleteVariableGroup(project, groupID) and treat non-nil errors as fatal.
  • Stop progress before printing output. Table output: Variable group deleted. JSON output: { "deleted": true, "groupId": <id> }.
  • Add debug logging for resolved IDs and confirmation decisions.

Command Wiring

  • Implement internal/cmd/pipelines/variablegroup/delete/delete.go exposing NewCmd(ctx util.CmdContext) *cobra.Command.
  • Register it from internal/cmd/pipelines/variablegroup/variablegroup.go so azdo pipelines variable-group delete is available alongside other variable-group commands.
  • Regenerate documentation (make docs) after wiring.

SDK / Client Requirements

  • Requires the Task Agent client (ClientFactory().TaskAgent(...)). If the client is missing, follow "Handling Missing Azure DevOps SDK Clients" in AGENTS.md.

Tooling & Validation

  • Format new Go files with gofmt/goimports.
  • Run go build ./cmd/azdo/... to ensure the CLI compiles.
  • Add/update hermetic tests using mocks (Task Agent client, prompts) and execute go test ./....

Testing

  • Unit tests covering:
    1. Successful deletion with --yes.
    2. Prompt decline returning util.ErrCancel.
    3. Lookup by name including collision handling.
    4. SDK error propagation.
    5. JSON export structure.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions