Remote configuration reconciliation via GitHub App token - #54
Conversation
… token Add scripts/remote-reconcile.sh and scripts/github-app-token.sh that enable the controller to fetch its desired-state configuration from the private rd-delivery-config repository using short-lived GitHub App installation tokens. - scripts/github-app-token.sh: generates JWT from existing private key, exchanges it for a short-lived installation token via the GitHub API. - scripts/remote-reconcile.sh: fetches default-branch HEAD, validates, checks drift, reconciles, reports state. Supports --check-only and --no-op modes. Bounded retries (3), sanitized logging. - host/systemd/ci-fleet-reconcile.service + .timer: periodic reconciliation every 5 minutes. - scripts/test_remote_reconcile.py: 14 regression tests for auth failure, missing state, secret redaction, systemd unit integrity. - Updated install-worker-controller.sh to manage the new timer. - Updated DESIRED-STATE.md and HOST-MAINTENANCE.md docs. Prerequisite: the rd-ci-fleet-01 GitHub App needs contents:read permission and rd-delivery-config repository access.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a93459d6ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1. Use auth_url for authenticated private fetch (P1) 2. Retry token generation on transient failure (P2) 3. Preserve durable config_repo identity in install-state (P1) 4. Remove Requires=ci-fleet-drift.service, use After=Wants= (P1) 5. Backwards-compat: reconcile units are optional in unit_names (P1) 6. Pass log message via argv, not source interpolation (P1) 7. Rollback via LKG re-apply, not checkpoint-latest (P1)
|
Addressed all 7 Codex findings in commit 589fb78:
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 589fb78651
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| [Timer] | ||
| OnBootSec=10min | ||
| OnUnitActiveSec=5min |
There was a problem hiding this comment.
Add reconciliation failures to fleet health monitoring
This adds a controller-lifecycle timer, but a repo-wide check of health.py shows that collect_snapshot monitors only the health, cleanup, and drift timers and only cleanup and drift services, with no consumer for reconciliation state. Consequently, a missing/disabled reconcile timer or persistent token and fetch failures can leave ordinary health reports and external heartbeats healthy indefinitely while reviewed desired state is no longer being applied; register this timer, service result, or reconcile state in the health contract.
Useful? React with 👍 / 👎.
Summary
Add
scripts/remote-reconcile.shandscripts/github-app-token.shso that the controller can fetch its desired-state configuration from a private desired-state configuration repository using short-lived GitHub App installation tokens — no PAT, no SSH, no inbound port.What
scripts/github-app-token.sh— generates a JWT from the existing app private key (openssl + curl, no new deps), exchanges it for a short-lived installation token.scripts/remote-reconcile.sh— fetches the default-branch HEAD of the desired-state repo, validates, checks drift, reconciles if changed, rolls back on failure. Supports--check-onlyand--no-op. Bounded retries (3). Sanitized logging (no keys/tokens in output).host/systemd/ci-fleet-reconcile.{service,timer}— periodic reconciliation every 5 minutes.scripts/install-worker-controller.sh— manages the new timer alongside existing health/cleanup/drift timers.scripts/test_remote_reconcile.py— 14 regression tests (auth failure, missing state, secret redaction, unit integrity).DESIRED-STATE.mdandHOST-MAINTENANCE.md.Design
Prerequisite (blocking)
The controller's GitHub App needs
contents: readon the private desired-state repository so the controller can fetch configuration over HTTPS. This is an org-level GitHub App permission change; exact installation details are tracked in the private configuration repository's rollout issue.Testing