Skip to content

Commit 62ad093

Browse files
jamesadevineCopilot
andcommitted
feat(secrets): add --all-repos and --source via Pipeline Preview discovery
Adds project-scope token management via two new flags on `secrets set`, `secrets list`, and `secrets delete`: - `--all-repos` — operate on every ado-aw pipeline ADO knows about in the project (direct ado-aw definitions *and* consumer pipelines that include ado-aw templates), regardless of which repo their root YAML lives in. - `--source <path>` — filter to consumers of one specific template. Both flags activate a new Preview-driven discovery path that calls `POST /_apis/pipelines/{id}/preview` per definition and scans the expanded YAML for an `# ado-aw-metadata: {…}` JSON marker. The legacy lexical local-fixture matcher remains the default; `--definition-ids` remains the explicit-ID escape hatch. To make discovery work, every compiled pipeline now carries a marker via a new always-on `AdoAwMarkerExtension`. The marker lives inside a bash Setup-job step because ADO's Preview API strips top-of-document comments during YAML expansion (verified empirically against live def 2434 in `msazuresphere/4x4`) but preserves comments inside step bodies. Uniform across all four targets (standalone / 1es / job / stage); no per-target placement special-casing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cb4eec2 commit 62ad093

16 files changed

Lines changed: 1413 additions & 46 deletions

File tree

docs/cli.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,27 @@ Global flags (apply to all subcommands): `--verbose, -v` (enable info-level logg
4444
- `--dry-run` - Print the planned set without calling the ADO API.
4545
- `--org / --project / --pat` - ADO context overrides (same semantics as the other lifecycle commands).
4646
- `--definition-ids <ids>` - Explicit pipeline definition IDs (comma-separated; skips local-fixture auto-detection).
47+
- `--all-repos` - **Project-scope mode.** Activates Preview-driven discovery and operates on every ado-aw pipeline ADO knows about in the project — direct ado-aw definitions *and* consumer pipelines that include ado-aw templates — regardless of which repo their root YAML lives in. Mutually exclusive with `--definition-ids`. Ignores local lock files for matching (uses ADO Pipeline Preview to find marker steps).
48+
- `--source <path>` - **Filter by template.** Restricts to definitions whose `# ado-aw-metadata` marker references the given source path (e.g. `agents/security-scan.md`). Activates the discovery code path; pairs with `--all-repos` to scope across the whole project. Mutually exclusive with `--definition-ids`.
4749

4850
- `secrets list [PATH]` - List variable names and their `isSecret` / `allowOverride` flags on every matched definition. **Never prints values.**
4951
- `--json` - Emit machine-readable JSON.
5052
- `--org / --project / --pat / --definition-ids` - As above.
53+
- `--all-repos / --source <path>` - As for `secrets set` (project-scope discovery).
5154

5255
- `secrets delete <name> [PATH]` - Delete the named variable from every matched definition. No-op when the variable is absent.
5356
- `--dry-run` - Print the planned deletion plan without calling the ADO API.
5457
- `--org / --project / --pat / --definition-ids` - As above.
58+
- `--all-repos / --source <path>` - As for `secrets set` (project-scope discovery).
59+
60+
### Project-scope discovery (`--all-repos` / `--source`)
61+
62+
`secrets set / list / delete` accept two opt-in flags that activate **Preview-driven discovery** instead of the default lexical local-fixture matching. They are the surface that solves token management for templates that get included by other pipelines.
63+
64+
- **`--all-repos`** — search every definition in the ADO project. With it, you can `secrets set GITHUB_TOKEN --all-repos` from anywhere; no local checkout of the consumer pipelines is needed.
65+
- **`--source <path>`** — filter results to definitions whose `# ado-aw-metadata` marker references that template. Useful for fan-out: `secrets set GITHUB_TOKEN --source agents/security-scan.md` rotates the token on every consumer pipeline that includes that template.
66+
67+
Both flags route through `ado-aw`'s `discover_ado_aw_pipelines` machinery, which calls ADO's Pipeline Preview API per definition and scans the expanded YAML for an `ado-aw-marker` step that every compiled pipeline now carries. `--definition-ids` remains the explicit-ID escape hatch and is mutually exclusive with these flags. `enable`, `disable`, and `remove` are **not** changed — they retain their source-scoped safety semantics.
5568

5669

5770
- `enable [PATH]` - Register an ADO build definition for each compiled pipeline discovered under `PATH` (or the current directory) and ensure it is `enabled`. For each fixture, matches against the existing ADO definitions by `yamlFilename` first, then by sanitized display name; creates a new definition when neither matches, flips `queueStatus` to `enabled` when an existing definition is `disabled` / `paused`, and skips when it is already `enabled`. Fail-soft per fixture; exits non-zero if any fixture failed.

0 commit comments

Comments
 (0)