Skip to content

plx-ci setup: one step that prepares a job, with every vault read in one function - #71

Merged
davidjalbers merged 17 commits into
plain-pipelinefrom
davidjalbers/plx-227-plx-ci-setup-one-step-that-prepares-a
Dec 2, 2026
Merged

davidjalbers merged 17 commits into
plain-pipelinefrom
davidjalbers/plx-227-plx-ci-setup-one-step-that-prepares-a

Conversation

@davidjalbers

@davidjalbers davidjalbers commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

plx-ci setup <repo|deploy> prepares a job of an app repo's pipeline in one step, after the checkout and mise (Decisions § 6.4, § 6.5, § 8.1 to § 8.3, § 3.9, § 5.10).
Every vault read of a job goes through one function, core/vault.ts.
repo-turbo asks ci_service_account; the workflows that act on it are not in this pull request.

What it does

The header of packages/cli-ci/src/commands/setup.ts states the steps in order.

  • The vault is read through the runner's Connect server where the runner carries OP_CONNECT_HOST and OP_CONNECT_TOKEN, and with OP_SERVICE_ACCOUNT_TOKEN otherwise; with both, op is started without the service account's token.
    With neither, the job fails in one line that names both.
  • Each secret is masked as it is read, before anything else is printed; a multi-line key is masked line by line, and a key pasted into a one-line field is masked again line by line as its lines are restored, so -v, which prints the input of ssh-add -, shows it masked.
  • repo: the server-actions key (repo_<repo>/server-actions-key) as the step output server-actions-key, in no variable of the job.
    A Docker config of the job's own under RUNNER_TEMP with the job's token for ghcr.io (DOCKER_CONFIG), and with --private-packages an npmrc for the forge's package registry (NPM_CONFIG_USERCONFIG); each file 0600 in a directory 0700.
  • deploy: the deploy key in an SSH agent on a socket under RUNNER_TEMP (SSH_AUTH_SOCK), and the step output operations-token, a token of the tenant's App that may read the operations repo and nothing else.
    Where GitHub answers 401 (key and client ID do not belong together, or the clock is off) or 404 (the App is not installed on the operations repo), the job fails in one line naming the App's client ID and <owner>/<operations repo>, the two told apart, with no secret.
    Under --dry-run it calls no API.
  • On a forge runner (RUNNER_ENVIRONMENT=github-hosted) with --overlay netbird, where the job is deploy or the repo names a cache host: join the overlay as _deploy.yml does it today, as the peer ci-<run id>-<job> so that the two joins of one run never meet each other's peer, and for repo hand PLX_TURBO_SHARED_TOKEN and PLX_TURBO_TRUSTED_TOKEN.
    On a slot it joins nothing and reads no cache token.

Decisions this pull request made that the issue did not

  • The App's token moves into plx-ci (§ 6.3 left it open). setup deploy signs the App's JWT itself and mints an installation token for the one repo with contents: read, by GitHub's documented endpoints, through curl -K -, which writes the HTTP status after the body (write-out) so that a refused call can be named. The job never holds the App's private key, which could mint tokens for every repo the App is installed on; keeping the action would have put that key into a step output. The cost: the token is not revoked at the end of the job, and expires within the hour.
  • Vault items for the two fixed cache tokens: turbo-cache/shared-token and turbo-cache/trusted-token in <owner>-ci.
  • Where the cache host comes from: PLX_TURBO_CACHE_HOST in the job's environment, which mise.toml's [env] would carry from the answer turbo_cache_host, behind one function (cacheHostOf). To be aligned with the cache-host work.
  • The registry login writes a Docker config ({"auths": {"ghcr.io": {"auth": …}}}) in a directory under RUNNER_TEMP named by DOCKER_CONFIG, instead of running crane auth login or docker login: no tool needs installing for it, a slot has no Docker daemon, and the runner empties RUNNER_TEMP at the end of each job. Tried: crane reads it (crane auth get). The encoded credential is masked.
  • No crane install: whether the image helper still needs crane on a forge runner is the image helper's question.
  • A deploy job gets no registry login: nothing in it reaches the registry; the host pulls with its own credentials.
  • The SSH agent is not stopped by a later step: a forge runner and a slot's container both end with the job.
  • A repo job whose overlay join fails goes on with a ::warning:: and the tokens handed, so that the verbs run without the remote cache (§ 5.8); a deploy job whose join fails fails.
  • The deploy job waits for the overlay's network map (Peers count naming any peer), since it does not know the app hosts before the inventory is checked out, even where the repo's environment names a cache host: the deploy key reaches the app hosts alone. A repo job waits for the cache host's name to resolve, as _deploy.yml waits for its host.
  • The App's client ID is read as no secret and not masked; that is the test for a short value inside a hash.
  • ci_service_account defaults to yes, and is asked of app repos only.
  • The NetBird client's version is a constant in core/setup.ts (0.82.0, today's default), no longer an input.

Lines

1024 added, 4 removed: 428 of source (commands/setup.ts 93, of which 58 are its header; core/setup.ts 281; core/vault.ts 54), 579 of tests and their fakes, 12 for the template question, 5 for the command list and the package's description.
The additions stay because they replace workflow YAML that the workflow issue deletes: in _e2e.yml, _publish-deploy.yml and _deploy.yml, five copies of "How the vault is read", seven loads of load-secrets-action, three crane installs, three registry logins, two package-registry logins, the App-token action of the deploy plan, the overlay join and the loading of the SSH key.

Verify

At e8113e3, the head after the review's fixes: the 28 tests of setup pass, and the hooks' mise check on each commit and mise test on the push passed.
At 5dfa643, before them, TURBO_FORCE=true mise run test and mise run e2e passed.
The forced test run at the new head and the e2e before the merge are in the reports to the coordinator.

🤖 Generated with Claude Code

davidjalbers and others added 15 commits December 2, 2026 04:08
Whether the workflows hand their jobs the service account token of the CI
vault; the workflows that act on it are rendered elsewhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as it, else with the service account (PLX-227)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… before the service account (PLX-227)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… key is in no variable of it (PLX-227)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d the logins to the forge's registries (PLX-227)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t, a token of the App for the operations repo (PLX-227)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he App that may read the operations repo (PLX-227)

The App's key stays in plx-ci: the job is handed a token for the one repo
and contents: read, masked, in place of an action that would need the key
as a step output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the app hosts, and a repo job gets the caches' tokens (PLX-227)

The command's header states its steps in order. The fakes of the tests
answer a plain download and keep the options of the command sudo runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@davidjalbers davidjalbers self-assigned this Dec 2, 2026
davidjalbers and others added 2 commits December 2, 2026 04:43
…ors, dry-run, modes, names (PLX-227)

- A deploy job on a forge runner waits for the network map even where the
  repo names a cache host, and reads no cache token.
- With -v, the lines of a key pasted into a one-line field are each masked
  before they are shown.
- A 404 and a 401 of the App's calls each end in one line naming the App's
  client ID and the operations repo, told apart, with no JWT; the fake curl
  answers as curl does under fail-with-body or write-out.
- Under --dry-run a deploy job calls nothing but the vault.
- The Docker config and the npmrc are 0600 in directories 0700; the npmrc
  moves to a directory of its own.
- The repo job joins as ci-<run>-repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, the App's errors named (PLX-227)

- A deploy job waits for the network map, never for the cache host: its
  key reaches the app hosts alone.
- keyLines masks every line it returns, so a key pasted into a one-line
  field is masked line by line however it is printed later, -v included.
- The App's calls read the HTTP status with write-out instead of
  fail-with-body: a 401 and a 404 each end in one line naming the App's
  client ID and the operations repo; the unreachable line for a missing
  installation is gone.
- Under --dry-run a deploy job calls no API.
- The Docker config and the npmrc are written 0600 in directories 0700;
  the npmrc in a directory of its own.
- A job joins the overlay as ci-<run id>-<job>, so the two joins of a run
  never meet each other's peer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@davidjalbers
davidjalbers merged commit 882c036 into plain-pipeline Dec 2, 2026
2 checks passed
@davidjalbers
davidjalbers deleted the davidjalbers/plx-227-plx-ci-setup-one-step-that-prepares-a branch December 2, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant