Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ac8074a
test: repo-turbo asks an app repo ci_service_account (PLX-227)
davidjalbers Dec 2, 2026
7c507f9
repo-turbo: an app repo answers ci_service_account (PLX-227)
davidjalbers Dec 2, 2026
8d9fec4
test: plx-ci setup reads the vault through Connect where the runner h…
davidjalbers Dec 2, 2026
7659d39
plx-ci setup: every vault read of a job through one function, Connect…
davidjalbers Dec 2, 2026
7fa1240
test: what plx-ci setup hands a repo job, and that the server-actions…
davidjalbers Dec 2, 2026
6c59fec
plx-ci setup repo: the server-actions key as a masked step output, an…
davidjalbers Dec 2, 2026
b0261dc
test: what plx-ci setup hands a deploy job: the deploy key in an agen…
davidjalbers Dec 2, 2026
00a6f18
plx-ci setup deploy: the deploy key in an SSH agent, and a token of t…
davidjalbers Dec 2, 2026
b484c45
test: plx-ci setup joins the overlay on a forge runner and never on a…
davidjalbers Dec 2, 2026
567db14
plx-ci setup: a forge runner joins the overlay for the cache host or …
davidjalbers Dec 2, 2026
bc0760c
plx-ci: the setup of a job is the first of its commands (PLX-227)
davidjalbers Dec 2, 2026
cf74e0c
Merge origin/plain-pipeline into the branch of PLX-227
davidjalbers Dec 2, 2026
9a4b602
test: the job's token, encoded in the Docker config, is masked (PLX-227)
davidjalbers Dec 2, 2026
1935dd9
plx-ci setup: the Docker config's credential is masked (PLX-227)
davidjalbers Dec 2, 2026
5dfa643
Merge origin/plain-pipeline into the branch of PLX-227
davidjalbers Dec 2, 2026
2dd7739
Test what the review of setup asks: the cache host, -v, the App's err…
davidjalbers Dec 2, 2026
e8113e3
Setup: the cache host for the repo job alone, keys masked as restored…
davidjalbers Dec 2, 2026
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
2 changes: 1 addition & 1 deletion packages/cli-ci/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@plexus-ms/cli-ci",
"version": "0.134.1",
"description": "plx-ci, the CI verbs of Plexus: the plan of a run, the publish of an app's image, throwaway runners on a cloud and their teardown",
"description": "plx-ci, the CI verbs of Plexus: the setup of a job, the plan of a run, the publish of an app's image, throwaway runners on a cloud and their teardown",
"license": "GPL-3.0-or-later",
"type": "module",
"bin": {
Expand Down
6 changes: 4 additions & 2 deletions packages/cli-ci/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Every command of plx-ci, in the order `plx-ci --help` lists them. Same rule
// as plx: a command module maps argv onto core/ and nothing more, and the
// logic, the planning and the tests live in core/. The universal commands
// come first, in the order a run uses them, and read the strategy; `hybrid`
// come first, in the order a run uses them: setup prepares a job, and the
// others read the strategy; `hybrid`
// holds what only that strategy needs. The display versions, opt-in per
// repo, read no strategy and sit where a release uses them, after publish.
import type { Command } from 'commander';
import { register as displayVersions } from './displayVersions.ts';
import { register as hybrid } from './hybrid.ts';
import { register as plan } from './plan.ts';
import { register as publish } from './publish.ts';
import { register as setup } from './setup.ts';

export const commands: ((program: Command) => void)[] = [plan, publish, displayVersions, hybrid];
export const commands: ((program: Command) => void)[] = [setup, plan, publish, displayVersions, hybrid];
390 changes: 390 additions & 0 deletions packages/cli-ci/src/commands/setup.test.ts

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions packages/cli-ci/src/commands/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// plx-ci setup <repo|deploy>: prepare a job of an app repo's pipeline in one
// step, after the checkout and mise (which brings plx-ci and the repo's tools)
// and before every other, so that each later step is one command. What it
// does depends on what the job is for, `repo` (the repo verbs, check to
// publish) or `deploy` (plx deploy), and on where it runs: a forge runner
// (RUNNER_ENVIRONMENT github-hosted) or a slot of the tenant's runner host,
// which is on the overlay already and whose repo slots carry their host's
// cache servers. In order:
//
// 1. Read from the vault `<owner>-ci` what the job needs, every read through
// the one function of core/vault.ts, which reaches the vault through the
// runner's Connect server where the runner carries one and with the
// service account otherwise, and masks each secret in the log as it
// reads it, before anything else is printed:
// repo repo_<repo>/server-actions-key; on a forge runner of a repo
// that names a cache host (PLX_TURBO_CACHE_HOST, from its
// mise.toml) on `--overlay netbird`, also netbird/setup-key
// and turbo-cache/shared-token and turbo-cache/trusted-token
// deploy deploy-ssh/private key (as OpenSSH), github-app/client-id,
// which is no secret and is not masked, and
// github-app/private-key; on a forge runner with `--overlay
// netbird`, also netbird/setup-key
// A key pasted into a one-line field gets its lines back, and each of
// them is masked as it is restored.
// 2. deploy: mint a token of the tenant's GitHub App that may read the
// operations repo (`--operations-repo`, default `operations`) and
// nothing else, and mask it. The App's key never leaves this process.
// Where GitHub refuses the App (401) or finds it not installed on the
// operations repo (404), the job fails in one line naming the App's
// client ID and the repo.
// 3. Say how the vault was read.
// 4. repo: log the job in to the forge's image registry with its own token
// (GITHUB_TOKEN as GITHUB_ACTOR), in a Docker config of the job's own
// under RUNNER_TEMP, which crane and buildx read; with
// `--private-packages`, to the forge's package registry too, in a
// user-level npmrc there. Each file is 0600 in a directory 0700.
// deploy: start an SSH agent on a socket under RUNNER_TEMP and add the
// deploy key.
// 5. On a forge runner, where step 1 read a setup key: join the overlay as
// an ephemeral peer named `ci-<run id>-<job>`, and wait until the cache
// host resolves (repo) or the network map names a peer (deploy, whose
// key reaches the app hosts and not the cache host). A repo job that
// cannot join goes on without the remote cache and warns on the run; a
// deploy job fails.
// 6. Hand later steps what they need. As outputs of the step:
// repo server-actions-key, for the build and publish steps alone
// deploy operations-token, for the checkout of the operations repo
// both joined=true, where the job joined the overlay
// As variables of the job (GITHUB_ENV): DOCKER_CONFIG and, with private
// packages, NPM_CONFIG_USERCONFIG; PLX_TURBO_SHARED_TOKEN and
// PLX_TURBO_TRUSTED_TOKEN where step 1 read them; SSH_AUTH_SOCK. No
// secret of the vault is a variable of the job but the two cache tokens.
//
// Under --dry-run it reads and masks, calls no API, and writes and starts
// nothing. Exit code 1 where a read, the token or a deploy job's join fails.
//
// plx-ci setup repo --overlay netbird --private-packages
// plx-ci setup deploy --overlay netbird
import type { Command } from 'commander';
import { Argument, Option } from 'commander';
import { JOBS, type Job, setup } from '../core/setup.ts';
import { OVERLAYS, type Overlay } from '../core/strategy.ts';
import { contextOf } from '../program.ts';

export function register(program: Command): void {
program
.command('setup')
.description('prepare a job: read what it needs from the vault, log it in, and hand later steps what they need')
.addArgument(new Argument('<job>', 'what the job is for: repo, the repo verbs; deploy, plx deploy').choices(JOBS))
.addOption(
new Option(
'--overlay <overlay>',
'how the job reaches the tenant’s hosts; netbird: a forge runner joins the overlay',
)
.choices(OVERLAYS)
.default('none'),
)
.option('--private-packages', 'the repo installs private packages from the forge’s package registry')
.option(
'--operations-repo <name>',
'deploy: the tenant’s operations repo, in the owner’s organisation',
'operations',
)
.action(
async (
job: Job,
opts: { overlay: Overlay; privatePackages?: boolean; operationsRepo: string },
command: Command,
) => {
await setup(contextOf(command), { job, ...opts });
},
);
}
Loading
Loading