This issue tracks the implementation of the azdo pipelines variable-group list command.
Command Description
List every variable group defined in a project with optional filtering. The CLI must fetch all pages automatically so that users never have to provide continuation tokens manually.
azdo Command Signature
azdo pipelines variable-group list [ORGANIZATION/]PROJECT [flags]
Flags:
--name: Wildcard pattern applied to the variable group name (groupName in the SDK).
--action: Action filter string (e.g., manage, use).
--top: Server-side page size hint (positive integer).
--order: asc or desc; map to idAscending / idDescending.
--max-items: Optional client-side cap on results; stop fetching once reached.
--continuation-token: Manual pagination token for debugging or partial results.
--group-type: Filter by variable group type (e.g., AzureKeyVault, Generic).
--include-details: Include additional details like variables, provider data, and project references. (By default only summary columns are shown.)
- JSON export flags registering the same fields as the
show/update commands (id, name, type, description, isShared, authorized, variables, variableGroupProjectReferences, providerData, etc.).
Behavior
- Parse the scope argument using existing helpers so
[ORGANIZATION/]PROJECT resolves the default organization when omitted.
- Acquire IO streams, start the progress indicator, and ensure it stops before printing output.
- Build
taskagent.GetVariableGroupsArgs with the supplied filters (GroupName, ActionFilter, Top, QueryOrder, ContinuationToken).
- Call a loader helper (e.g.,
azdo.GetVariableGroups) that mirrors azdo.GetProjects and loops through continuation tokens until the server stops issuing them. This makes --continuation-token unnecessary for end users; the command must return the complete set by default.
- Respect
--max-items by truncating the collected slice after pagination completes; log via zap.L().Debug when truncation happens.
- Render default table columns:
ID, NAME, TYPE, VARIABLE COUNT, DESCRIPTION. When --include-details is provided, add VARIABLE KEYS, AUTHORIZED, PROJECT REFERENCES, and PROVIDER DATA columns. Mask secret values.
- For JSON export, emit
{ "variableGroups": [...] } with the view struct used by show, filtering fields according to the --include-details flag unless the user explicitly selects them via --json.
- Validate
--top and --max-items are positive integers and return an error for unknown --order or --group-type values.
Supporting Helpers
- Add
func GetVariableGroups(ctx context.Context, client taskagent.Client, args taskagent.GetVariableGroupsArgs) ([]taskagent.VariableGroup, string, error) to internal/azdo/loader.go. The helper should:
- Invoke the client, append
Value results when non-nil, and surface the last ContinuationToken for debugging (also returned when the user supplies --continuation-token).
- Reissue requests with the server
ContinuationToken until it is empty.
- Handle numeric tokens similarly to
GetProjects, returning wrapped errors when parsing fails.
- Write focused unit tests for the helper using mocks to cover multi-page responses, token parsing failures, and error propagation.
Command Wiring
- Implement the command in
internal/cmd/pipelines/variablegroup/list/list.go with NewCmd(ctx util.CmdContext) *cobra.Command.
- Register it from
internal/cmd/pipelines/variablegroup/variablegroup.go so azdo pipelines variable-group list is reachable.
- Regenerate documentation (
make docs) after wiring.
SDK / Client Requirements
- Requires the Task Agent client (
ClientFactory().TaskAgent(...)) for listing variable groups. If the client is not yet exposed, follow “Handling Missing Azure DevOps SDK Clients” in AGENTS.md.
Tooling & Validation
- Format new Go files with
gofmt/goimports.
- Run
go build ./cmd/azdo/... (or make lint) to ensure imports and types are correct.
- Add/update hermetic tests using mocks and run
go test ./....
Testing
- Unit tests verifying:
- Listing with a single page via the loader helper.
- Multi-page pagination without user-supplied continuation tokens.
--max-items truncation.
- Invalid flag handling (
--order, --top, --max-items, --group-type).
- JSON export structure.
--include-details output with masked secrets.
References
This issue tracks the implementation of the
azdo pipelines variable-group listcommand.Command Description
List every variable group defined in a project with optional filtering. The CLI must fetch all pages automatically so that users never have to provide continuation tokens manually.
azdoCommand Signatureazdo pipelines variable-group list [ORGANIZATION/]PROJECT [flags]Flags:
--name: Wildcard pattern applied to the variable group name (groupNamein the SDK).--action: Action filter string (e.g.,manage,use).--top: Server-side page size hint (positive integer).--order:ascordesc; map toidAscending/idDescending.--max-items: Optional client-side cap on results; stop fetching once reached.--continuation-token: Manual pagination token for debugging or partial results.--group-type: Filter by variable group type (e.g.,AzureKeyVault,Generic).--include-details: Include additional details like variables, provider data, and project references. (By default only summary columns are shown.)show/updatecommands (id,name,type,description,isShared,authorized,variables,variableGroupProjectReferences,providerData, etc.).Behavior
[ORGANIZATION/]PROJECTresolves the default organization when omitted.taskagent.GetVariableGroupsArgswith the supplied filters (GroupName,ActionFilter,Top,QueryOrder,ContinuationToken).azdo.GetVariableGroups) that mirrorsazdo.GetProjectsand loops through continuation tokens until the server stops issuing them. This makes--continuation-tokenunnecessary for end users; the command must return the complete set by default.--max-itemsby truncating the collected slice after pagination completes; log viazap.L().Debugwhen truncation happens.ID,NAME,TYPE,VARIABLE COUNT,DESCRIPTION. When--include-detailsis provided, addVARIABLE KEYS,AUTHORIZED,PROJECT REFERENCES, andPROVIDER DATAcolumns. Mask secret values.{ "variableGroups": [...] }with the view struct used byshow, filtering fields according to the--include-detailsflag unless the user explicitly selects them via--json.--topand--max-itemsare positive integers and return an error for unknown--orderor--group-typevalues.Supporting Helpers
func GetVariableGroups(ctx context.Context, client taskagent.Client, args taskagent.GetVariableGroupsArgs) ([]taskagent.VariableGroup, string, error)tointernal/azdo/loader.go. The helper should:Valueresults when non-nil, and surface the lastContinuationTokenfor debugging (also returned when the user supplies--continuation-token).ContinuationTokenuntil it is empty.GetProjects, returning wrapped errors when parsing fails.Command Wiring
internal/cmd/pipelines/variablegroup/list/list.gowithNewCmd(ctx util.CmdContext) *cobra.Command.internal/cmd/pipelines/variablegroup/variablegroup.gosoazdo pipelines variable-group listis reachable.make docs) after wiring.SDK / Client Requirements
ClientFactory().TaskAgent(...)) for listing variable groups. If the client is not yet exposed, follow “Handling Missing Azure DevOps SDK Clients” inAGENTS.md.Tooling & Validation
gofmt/goimports.go build ./cmd/azdo/...(ormake lint) to ensure imports and types are correct.go test ./....Testing
--max-itemstruncation.--order,--top,--max-items,--group-type).--include-detailsoutput with masked secrets.References
variable_group_list