Skip to content

feat: Implement azdo pipelines variable-group variable list command #125

@tmeckel

Description

@tmeckel

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

Command Description

List the variables in a variable group. The Azure CLI retrieves the group and returns the variables dictionary as-is (source). azdo should expose the same information with user-friendly formatting, readOnly metadata, and JSON export.

azdo Command Signature

azdo pipelines variable-group variable list [ORGANIZATION/]PROJECT/VARIABLE_GROUP_ID_OR_NAME

Behavior

  • Resolve project scope and group identifier via the shared helper.
  • Start the progress indicator, fetch the group, then stop the indicator prior to rendering output.
  • If the group is missing, return a descriptive error.
  • Sort variables alphabetically for deterministic output.
  • Default table columns: NAME, VALUE (mask when secret), SECRET (Yes/No), READ-ONLY (Yes/No).
  • Register JSON fields with util.AddJSONFlags(cmd, &opts.exporter, []string{"name","secret","readOnly","value"}) and emit a slice of { name, secret, readOnly, value *string }. Drop the value pointer when secret is true so filtering via --json name,secret works predictably.
  • Add zap.L().Debug logs for group resolution.

Command Wiring

  • Implement internal/cmd/pipelines/variablegroup/variable/list/list.go with NewCmd(ctx util.CmdContext) *cobra.Command.
  • Register it from internal/cmd/pipelines/variablegroup/variable/variable.go so the hierarchy exposes azdo pipelines variable-group variable list.
  • Run make docs after wiring.

SDK / Client Requirements

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

Tooling & Validation

  • gofmt/goimports new files.
  • go build ./cmd/azdo/... to ensure compilation.
  • Add/update hermetic tests with mocks; run go test ./....

Testing

  1. Successful listing with secret + non-secret variables.
  2. Missing group error.
  3. Deterministic ordering.
  4. 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