Merge pull request 'docs(adr): amend ADR-0032 with the pre-merge Ansible dry run' (#222) from docs/adr-0032-ansible-dry-run into main
Reviewed-on: #222
This commit was merged in pull request #222.
This commit is contained in:
commit
e3d4219323
1 file changed
+36
-8
@@ -32,10 +32,19 @@ Every package skill classifies each command it drives into one tier:
|
|||||||
Agents never decrypt Ansible Vault or Sealed Secrets and never read the material that would. Stage
|
Agents never decrypt Ansible Vault or Sealed Secrets and never read the material that would. Stage
|
||||||
sessions use a kubeconfig bound to the built-in `view` ClusterRole (which excludes Secrets) plus a
|
sessions use a kubeconfig bound to the built-in `view` ClusterRole (which excludes Secrets) plus a
|
||||||
read-only aggregated role for `SealedSecret` objects. Ansible stage work runs only what succeeds with
|
read-only aggregated role for `SealedSecret` objects. Ansible stage work runs only what succeeds with
|
||||||
a placeholder vault password (`--syntax-check`, `ansible-lint`, inventory reads). A real
|
a placeholder vault password (`--syntax-check`, `ansible-lint`, inventory reads).
|
||||||
`--check --diff` before merge is reopened: check mode still runs PR-controlled code (lookups,
|
|
||||||
`delegate_to: localhost`, `check_mode: false` tasks, plugins) with the production credentials, so
|
Ansible's pre-merge `--check --diff` runs in CI from the base branch's copy (`pull_request_target`)
|
||||||
running it in CI on a bot PR hands the bot those credentials. Decided in
|
with the production vault password and SSH key. It runs automatically on human-authored PRs. On a
|
||||||
|
bot-authored PR it runs only after a user on the human allowlist adds the `Dry run` label, and after
|
||||||
|
every bot push the label must be removed and re-added, because the push leaves the new head without
|
||||||
|
a status. This is because PR code really executes: `check_mode: false` tasks on production hosts,
|
||||||
|
and lookups, plugins and `delegate_to: localhost` on the runner with the production credentials.
|
||||||
|
The gate guards against accidents, not a hostile bot: a bot branch can already reach the secrets
|
||||||
|
through a workflow of its own (see the same-repo-branch accepted risk). It runs only the Ansible
|
||||||
|
stages (pve, lxc, vm, services) the change touches, shares the `homelab-provision` concurrency
|
||||||
|
group, and its required status proves the preview ran on the head commit, not that check mode
|
||||||
|
passed. Failed tasks are shown in the PR comment for the approver to judge. Decided in
|
||||||
[Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200).
|
[Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200).
|
||||||
|
|
||||||
## Enforcement layers
|
## Enforcement layers
|
||||||
@@ -52,8 +61,9 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
|
|||||||
- every PR carries the dry run as a required status and a PR comment; apply happens after merge.
|
- every PR carries the dry run as a required status and a PR comment; apply happens after merge.
|
||||||
Flux's is an offline rendered diff of base and head that holds no cluster credential; a live
|
Flux's is an offline rendered diff of base and head that holds no cluster credential; a live
|
||||||
`flux diff` needs write RBAC, because Kubernetes authorises dry-run requests like real ones, so
|
`flux diff` needs write RBAC, because Kubernetes authorises dry-run requests like real ones, so
|
||||||
it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later
|
it is not used. Ansible's is a CI `--check --diff` from the base branch's copy, gated on bot
|
||||||
`tofu plan`;
|
PRs by an allowlisted human's `Dry run` label, re-added after every bot push; its status proves the preview ran on
|
||||||
|
the head commit, not that check mode passed (see Secrets). Later `tofu plan`;
|
||||||
- in step mode (v1) the human launching a stage is the approval, and stage leads check gate
|
- in step mode (v1) the human launching a stage is the approval, and stage leads check gate
|
||||||
state only: the stage's gate label, if it has one, is present, and for verify the PR is
|
state only: the stage's gate label, if it has one, is present, and for verify the PR is
|
||||||
merged with a non-stale, non-dismissed approval by a user on the human allowlist in
|
merged with a non-stale, non-dismissed approval by a user on the human allowlist in
|
||||||
@@ -70,8 +80,16 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
|
|||||||
|
|
||||||
- **Agent drafts odd jobs, human runs them** (no agent ever holds apply credentials): rejected by the
|
- **Agent drafts odd jobs, human runs them** (no agent ever holds apply credentials): rejected by the
|
||||||
owner in favour of agent-run odd jobs in HITL sessions with per-command ask.
|
owner in favour of agent-run odd jobs in HITL sessions with per-command ask.
|
||||||
- **Gated vault-touching check runs, or a scoped vault credential for agents**: rejected — moving
|
- **A scoped vault credential for agents**: rejected — running `--check --diff` in CI removes the
|
||||||
`--check --diff` to CI removes the conflict without loosening the read rule.
|
conflict without loosening the read rule.
|
||||||
|
- **A scoped vault or check-only SSH user for the CI dry run**: rejected — a check-only user still
|
||||||
|
needs `become`, which is root, and a scoped vault drifts from the real one.
|
||||||
|
- **Ungated vault-touching check runs on bot PRs**: rejected — check mode still executes
|
||||||
|
PR-controlled code with the production credentials (`check_mode: false` tasks on production
|
||||||
|
hosts; lookups, plugins and `delegate_to: localhost` on the runner), so an ungated run would let
|
||||||
|
bot-authored code act on production before any human looks. The bot path is gated instead: the
|
||||||
|
run starts only on an allowlisted human's `Dry run` label, re-added after every bot push (see
|
||||||
|
Secrets).
|
||||||
- **Apply before merge** (Atlantis model): rejected — Gitea has no native support; merge-then-apply
|
- **Apply before merge** (Atlantis model): rejected — Gitea has no native support; merge-then-apply
|
||||||
with the dry run as a required check is the existing pattern in the reference repo.
|
with the dry run as a required check is the existing pattern in the reference repo.
|
||||||
- **A deny hook on test paths**: rejected for v1 — a repo-wide hook cannot portably tell the test
|
- **A deny hook on test paths**: rejected for v1 — a repo-wide hook cannot portably tell the test
|
||||||
@@ -99,12 +117,22 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
|
|||||||
- **Accepted risk:** Copilot CLI's TUI auto-approves a hook `ask` (github/copilot-cli#3590, open
|
- **Accepted risk:** Copilot CLI's TUI auto-approves a hook `ask` (github/copilot-cli#3590, open
|
||||||
since v1.0.53), so on Copilot an odd-job ask may run without a human answer. The owner kept ask
|
since v1.0.53), so on Copilot an odd-job ask may run without a human answer. The owner kept ask
|
||||||
on Copilot rather than deny; Copilot is untested in v1 and the credential boundary still holds.
|
on Copilot rather than deny; Copilot is untested in v1 and the credential boundary still holds.
|
||||||
|
- **Accepted risk:** human-authored PRs run PR code against production hosts before approval. The
|
||||||
|
Ansible dry run starts automatically on them, and check mode executes `check_mode: false` tasks on
|
||||||
|
the hosts, and lookups, plugins and `delegate_to: localhost` on the runner, for real; the owner
|
||||||
|
accepted this for human authors and gated only the bot.
|
||||||
- The guard hook (`plugins/delivery/.apm/hooks/guard.py`) also checks file-tool paths (Read, Grep,
|
- The guard hook (`plugins/delivery/.apm/hooks/guard.py`) also checks file-tool paths (Read, Grep,
|
||||||
Edit, Write, Copilot's `view`, Codex's `apply_patch`) against the secret-path globs, not only
|
Edit, Write, Copilot's `view`, Codex's `apply_patch`) against the secret-path globs, not only
|
||||||
shell commands. `kubectl`, `helm`, `flux` and `tofu` are allowlists of subcommands that change no
|
shell commands. `kubectl`, `helm`, `flux` and `tofu` are allowlists of subcommands that change no
|
||||||
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
|
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
|
||||||
subcommand fails safe. Codex cannot ask, so odd jobs are
|
subcommand fails safe. Codex cannot ask, so odd jobs are
|
||||||
denied there; an unrecognised runtime is treated the same way.
|
denied there; an unrecognised runtime is treated the same way.
|
||||||
|
- *Amended 2026-11-25 ([Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200)):
|
||||||
|
the reopened Ansible `--check --diff` now runs in CI from the base branch's copy with production
|
||||||
|
credentials — automatic on human-authored PRs, gated on bot PRs by an allowlisted human's
|
||||||
|
`Dry run` label, re-added after every bot push; the gated-run rejection was narrowed to ungated
|
||||||
|
runs on bot PRs, a scoped vault or check-only user for CI was rejected, and human-authored PRs
|
||||||
|
running PR code against production before approval became an accepted risk.*
|
||||||
- *Amended 2026-11-23 ([delivery-handoff skill](https://git.rkdr.net/Mortis/Holocron/issues/191)): stage
|
- *Amended 2026-11-23 ([delivery-handoff skill](https://git.rkdr.net/Mortis/Holocron/issues/191)): stage
|
||||||
leads check gate state only and the who-set-the-label check moved to the run-mode launcher,
|
leads check gate state only and the who-set-the-label check moved to the run-mode launcher,
|
||||||
because gitea-mcp v1.13.0 has no timeline method, the timeline needs a token on private repos,
|
because gitea-mcp v1.13.0 has no timeline method, the timeline needs a token on private repos,
|
||||||
|
|||||||
Reference in new issue
Block a user