Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/repo-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The carried `AUDIT.md` reaches the hub at `main` for its configuration check, or

## Per-Repository Secrets

Downstream repositories carry no copy of `spec/secrets.json`. `baseline` applies to every fleet repo by definition. `mechanisms`/`targetMechanisms`/`typeMechanisms` resolve from the registry entry (a repo's `publish[]` targets and `types[]`) rather than from anything repo-specific. So a per-repo copy could only restate the hub's own computation or drift from it between resyncs. `uv run --no-project --script spec/audit.py [RepoName]`, run from a hub checkout, resolves the required set the same way the mechanized `repo-setup` check does. `targetMechanisms`/`typeMechanisms` selects each applicable mechanism from the registry entry. `baseline` plus the selected `mechanisms` plus the registry entry's own `requiredSecrets[]` (the repo's domain-specific additions) gives the required and forbidden names. The result is cross-checked against the repo's live Actions and Dependabot secret stores.
Downstream repositories carry no copy of `spec/secrets.json`. `baseline` applies to every fleet repo by definition. `mechanisms`/`targetMechanisms`/`typeMechanisms` resolve from the registry entry (a repo's `publish[]` targets and `types[]`) rather than from anything repo-specific. So a per-repo copy could only restate the hub's own computation or drift from it between resyncs. `uv run --no-project --script spec/audit.py "<RepoName>"`, run from a hub checkout, resolves the required set the same way the mechanized `repo-setup` check does. `targetMechanisms`/`typeMechanisms` selects each applicable mechanism from the registry entry. `baseline` plus the selected `mechanisms` plus the registry entry's own `requiredSecrets[]` (the repo's domain-specific additions) gives the required and forbidden names. The result is cross-checked against the repo's live Actions and Dependabot secret stores.

`configure.sh apply` sets those same names, resolved by the same `spec/secret_names.py`, from the host's `~/.secrets/` directory. `configure.sh check` asserts them per store. The file each value is read from follows the name's scope in `spec/secrets.json`. See [`repo-config/README.md` "Provisioning From `~/.secrets/`"][repo-config-readme-provisioning] for the file names, the strict-scope rule, and the `scaffold` command that pre-creates the files.

Expand All @@ -32,10 +32,10 @@ Downstream repositories carry no copy of `spec/secrets.json`. `baseline` applies
Run `configure.sh apply` from a hub checkout at `main`, naming the target repository and its model. `apply` refuses, writing nothing, a repository with no entry in the registry it reads. Without the entry, the rulesets and policy files would come from the default policy. Once `apply` has created both rulesets, remove all classic branch-protection rules and stray rulesets. Removed first, they would leave the branches unprotected wherever `apply` then refuses. A repository whose entry has merged to `develop` but not yet been promoted is configured and checked from a hub checkout at `develop`. Every other repository's run stays on `main`. Both modes need project access on the token as well as admin on the repository, since the project link is read and written through GraphQL. A token that cannot read projects stops `apply` in its pre-flight with nothing written, naming the scope to grant. Under `check` such a token reads as a failing project group. A token that can read them but not write one reaches the link write itself and fails there. The script applies `settings.json` and, on a public repository, the interaction limit. It also applies the Dependabot security features, the label set, both rulesets, the link to the fleet project, and the repository's secrets from `~/.secrets/`. The link is written only where it is absent. The declared project title is compared with the live one first. The comparison exists because a project number is reusable and the same declared number is applied to every fleet repository. A registered repository can omit the model and use the registry lookup. The model is passed as:

```sh
repo-config/configure.sh apply owner/repo release|operational
repo-config/configure.sh apply owner/repo release # substitute operational for an operational repo
```

Then validate the result with `repo-config/configure.sh check owner/repo release|operational`, run from the same checkout. The command asserts every applied ruleset, setting, interaction limit, label, security feature, and the fleet project link, plus the deployment environments described below. An interaction limit with fewer than 30 days left is a warning rather than drift, and a fresh `apply` renews it, per [`repo-config/README.md` "Public Interaction"][repo-config-readme-public-interaction]. It exits non-zero on drift (the settings checks are driven by the committed payloads, and the ruleset checks by the payloads composed for the repo). Or import each ruleset by hand from the payloads `configure.sh` composes for the repo. Write them with `uv run --no-project --script scripts/agent_policy.py rulesets --registry registry/repos.json --name <repo> --model <release|operational> --out-dir <dir>`. Then run `gh api -X POST repos/<owner>/<repo>/rulesets --input <dir>/<name>.json` for each of `develop` and `main`. `gh ruleset` is read-only, so creation goes through `gh api`. [`repo-config/README.md` "Rulesets"][repo-config-readme-rulesets] says what the composition changes. The required check binds by name and only turns green after the repo's PR workflow runs once. To edit a live ruleset, GET it, change the field, and PUT the whole writable subset back (a partial PUT `422`s).
Then validate the result with `repo-config/configure.sh check owner/repo release` (substitute `operational` for an operational repo), run from the same checkout. The command asserts every applied ruleset, setting, interaction limit, label, security feature, and the fleet project link, plus the deployment environments described below. An interaction limit with fewer than 30 days left is a warning rather than drift, and a fresh `apply` renews it, per [`repo-config/README.md` "Public Interaction"][repo-config-readme-public-interaction]. It exits non-zero on drift (the settings checks are driven by the committed payloads, and the ruleset checks by the payloads composed for the repo). Or import each ruleset by hand from the payloads `configure.sh` composes for the repo. Write them with `uv run --no-project --script scripts/agent_policy.py rulesets --registry registry/repos.json --name "<repo>" --model release --out-dir "<dir>"` (substitute `operational` for an operational repo). Then run `gh api -X POST "repos/<owner>/<repo>/rulesets" --input "<dir>/<name>.json"` for each of `develop` and `main`. `gh ruleset` is read-only, so creation goes through `gh api`. [`repo-config/README.md` "Rulesets"][repo-config-readme-rulesets] says what the composition changes. The required check binds by name and only turns green after the repo's PR workflow runs once. To edit a live ruleset, GET it, change the field, and PUT the whole writable subset back (a partial PUT `422`s).

## Central Bot Settings

Expand All @@ -51,7 +51,7 @@ A central file with automatic review off silences the bot on every repository th

```sh
uv run --no-project --script scripts/central_config.py precondition --repo ptr727/coderabbit --registry registry/repos.json
uv run --no-project --script scripts/central_config.py write --repo ptr727/coderabbit --registry registry/repos.json --checkout <checkout of ptr727/coderabbit>
uv run --no-project --script scripts/central_config.py write --repo ptr727/coderabbit --registry registry/repos.json --checkout "<checkout of ptr727/coderabbit>"
uv run --no-project --script scripts/central_config.py check --repo ptr727/pr-agent-settings --registry registry/repos.json --ref main
```

Expand Down
4 changes: 2 additions & 2 deletions host-setup/linux/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,8 @@ microsoft_feed() {
warn "Microsoft publishes no feed for $DISTRO_ID $DISTRO_VERSION, or the download failed"
return 1
fi
# The PowerShell install runs this with errexit off and goes on to remove a working pwsh.
# So a failed install ends the run here, on the dotnet path as well.
# Both callers run with errexit off and stop on a failed feed before they remove anything.
# A failed install ends the run here instead, rather than failing only the tool as the missing feed above does.
run_root dpkg -i "$deb" || die "Cannot install Microsoft's feed from $deb"
APT_DIRTY=true
apt_refresh
Expand Down
Loading
Loading