Skip to content

PLX-257: a runner host turns on its Connect server from ci/ through the Terraform modules - #94

Merged
davidjalbers merged 14 commits into
plain-pipeline-2from
davidjalbers/plx-257-connect-on-a-runner-host-by-terraform
Dec 3, 2026
Merged

davidjalbers merged 14 commits into
plain-pipeline-2from
davidjalbers/plx-257-connect-on-a-runner-host-by-terraform

Conversation

@davidjalbers

@davidjalbers davidjalbers commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

PLX-257: a tenant can state that a runner host runs a Connect server of its own (§ 7.6), per host and as a default for all hosts, from the root ci/ through both modules into the user-data.

What a tenant writes

In ci/hosts.auto.tfvars: connect_server = true in defaults for every host, or in one host's entry (hosts = { "ci-1" = { connect_server = true } }); a host's own value wins.
The playbook then reads the item 1password-connect (fields credentials and token, as vars/vault.yml already names them) from the vault <owner>-ci-host, so the tenant creates that item first.
connect_server = false stays the default of the modules and of the template.

Hosts that exist

A host that leaves it off is not replaced: the variable reaches the values file only when true (as netbird_management_url does when given), so its user-data is the same text as before.
This is held by a test that pins the SHA-256 of the rendered user-data for fixed variables to the value recorded on the integration branch before the change, and by a second one that the key is absent when off.
Turning it on, for a host or in the defaults, replaces the host, like any user-data change; run ci-runner-unregister first.
The one place this deviates from turbo_cache_overlay, which is always in the values file (false included): copying that would change every host's user-data.

A hosts file born at an earlier version has no connect_server in its defaults, and plx update does not add it (the file is born once).
The root therefore holds a map of fallbacks, connect_server = false, merged under defaults and the host's entry, and leaves the fallback keys out of the "missing" check.
Such a file plans as it is, with the same settings as one that states connect_server = false.
A misspelt key or a null in defaults or in a host's entry is still refused by name.
The rule is stated beside the map: an attribute may get a fallback only where its fallback leaves the user-data of hosts that exist byte for byte as it was.
A new repo's born file states connect_server = false.

How it was tested

  • terraform test in both modules (27 and 18 runs, mocked provider, no token): with it on actions_runners_connect is the boolean true in the values file and reaches the server's user-data; with it off the hash is the recorded one and the key absent; with it on the token is still the only secret and no pointer, credentials file or OP_CONNECT is in the user-data.
  • packages/lib render tests: the hosts file, the attribute list and the root's call, that the root's attributes equal the module's inputs, and the warning at connect_server (hosts file and root).
  • packages/lib/src/ciRoot.test.ts renders the root, points it at copies of the workspace modules and a mocked provider (installed from the plugin cache, no network), and runs terraform test: a hosts file without the key plans, the host takes false, a host can turn it on, a typo and a null are refused by name, another missing attribute is still refused. It cannot see the module's user-data (a root test reaches module outputs only); that is held by the module test's hash.
  • The hash test was seen red by making the module emit actions_runners_connect = false.
  • mise run test exit 0.
  • The newborn newborns/repo-operations.test.ts was edited (the plan's settings for an own and a usual value) and not run; it needs the e2e machinery.

Each test commit is red first: the module tests failed on the assertion because the variable did not exist (Terraform only warns about an undeclared variable in a run block), the lib tests failed on the missing line and the old header regex.

Readings

  • Variable name connect_server; the playbook's actions_runners_connect is its value key.
  • The user-data carries nothing new and no secret beyond the one bootstrap token (§ 7.10): the credentials file and the token are read on the host from the vault by the playbook.
  • The host needs nothing else from the modules: the Connect server listens on loopback and the Docker bridge, so the provider's firewall needs no rule and the host's own firewall no change; the images come from Docker Hub over the host's outbound traffic, which the provider's firewall allows.
  • How a job finds the server, read from the role and not tried: ci-runner-slot sources /etc/ci-runner/connect.env (the token and the port) for every slot and hands the slot OP_CONNECT_TOKEN and OP_CONNECT_HOST=http://127.0.0.1:<port>, which it builds itself. vaultOf in plx-ci uses Connect when both are set, starting op without the service account token (§ 8.1). So it works by reading, with no change to plx-ci.
  • The role's own warning stands, now one line away from a tenant's hands: with Connect a repo slot's token reads the whole CI vault, the deploy key included (§ 7.3 sits badly with it), and whether one set of credentials serves several hosts at once is untried (§ 7.6, "a trial finds out").
    The variable's description says both.
  • Not tried: any real host, vault, Connect credentials, or a job's read through the server.

Reading for the maintainer to confirm: the fallback

The alternative is the strict rule: the hosts file states every attribute, and a file born earlier needs connect_server = false by hand in defaults, found when someone runs plan (validate does not read values, so the update's pull request is green).
optional(bool, false) is no way out: defaults and hosts are type = any, and typing them as objects would drop unknown keys and nulls without a word, so a typo would quietly give a host the default.

Questions for the maintainer

These change no code here.

  1. Connect on a host with repo slots, against Decisions § 7.3 (a repo slot never holds the deploy key), § 3.9 (the server-actions key is not in the job's environment) and § 8.4 (a job handed no token reads nothing from the vault).
    With Connect every slot's environment holds a token that reads all of <owner>-ci.
    The role and the compendium accept this knowingly; the decisions do not say so.
    Options: a Connect token per slot kind over vaults that differ; Connect only on hosts without repo slots; or the risk accepted in the decisions in so many words.
  2. § 7.6 says a trial finds out whether one set of credentials serves several hosts.
    This lets a tenant turn it on for every host with one line in defaults before that trial.
    Should it stay per host until then, or is the opt-in enough?
  3. § 7.10 and § 7.13 list what the user-data states and what the module takes: the slots and whether the host serves its caches on the overlay.
    connect_server is a third.
    Should the decisions name it?

What the compendium owes

In approaches/delivery.md (§ 8 PLX-Delivery):

  • The user-data states the slots, whether the host serves its caches on the overlay, and whether it runs a Connect server (about line 287), and the module's variables include it (about line 293).
  • The tenant asks for a Connect server with connect_server in ci/hosts.auto.tfvars, per host or in defaults; actions_runners_connect is the playbook's value (about line 353).
  • What a tenant sets up (about line 367): the item 1password-connect in <owner>-ci-host, with the fields credentials (the text of 1password-credentials.json) and token; turning it on replaces the host, so run ci-runner-unregister first.

🤖 Generated with Claude Code

davidjalbers and others added 14 commits December 3, 2026 03:24
…s (red)

The user-data of a host with it off is held byte for byte; with it on,
actions_runners_connect reaches the values file as a boolean.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
connect_server travels like turbo_cache_overlay, but reaches the values file
only when true, so that the user-data of every host that leaves it off is
unchanged.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
… usual values

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…r rule and the warning where a tenant decides (red)

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…e for a fallback, and the warning where a tenant decides

The root merges a map of fallbacks under the defaults and the host; only an
attribute whose fallback leaves the user-data of existing hosts byte for byte
as it was may have one. The user-data module's header states the rule for what
reaches the values file. Two test corrections made with this change: the
header regex is case-insensitive, and a case that contradicted its own
assertion is dropped.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…ers/plx-257-connect-on-a-runner-host-by-terraform
…he lib tests see the modules; a missing provider cache says how to fill it

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
… where it differs from the role's default

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…ers/plx-257-connect-on-a-runner-host-by-terraform
…ers/plx-257-connect-on-a-runner-host-by-terraform
…ers/plx-257-connect-on-a-runner-host-by-terraform
…ur codes

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
…ers/plx-257-connect-on-a-runner-host-by-terraform
@davidjalbers
davidjalbers merged commit aa2ebd6 into plain-pipeline-2 Dec 3, 2026
2 checks passed
@davidjalbers
davidjalbers deleted the davidjalbers/plx-257-connect-on-a-runner-host-by-terraform branch December 3, 2026 04:06
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