feat(deploy): carry the registry credential in the deployment payload #514

Merged
gmackie merged 1 commit from feat/deploy-registry-credential into main 2026-08-28 01:10:51 +00:00
Owner

Removes the hand-set node config that #513 depends on.

#513 made the registry build able to authenticate, but the credential's only source was FG_NPM_TOKEN written by hand into /etc/forgegraph/agent.env on hetzner-fg. That is invisible, unreproducible, and silently absent on every other node — the next node to build the registry would fail exactly as this one did, with no indication why.

CI already solved this. fetchQueuedCIJobs attaches a resolved registry config per repository via resolveCIRegistryForRepository. Deployments resolve the same repositoryId a few lines earlier in the poll route, so this reuses the same helper and carries the result in the payload.

  • poll route — resolve the registry alongside the repository lookup already happening, attach as registry
  • client — PendingDeployment.Registry, matching the field CIJob already has
  • agent — buildEnv exports FG_NPM_TOKEN for nix build, mirroring how gitauth supplies git credentials. Environment rather than argv for the same stated reason: argv is world-readable through /proc.

Absent a configured registry the token is empty and buildEnv returns nil, so nix inherits the parent environment exactly as before — public flakes are untouched.

Tests — 4 new Go tests on the env assembly: the token is carried, the parent environment is preserved when materialised, a git credential and an npm token coexist (the case that would break if either clobbered the other), and an empty token is never exported. go build/vet clean, existing internal/deploy and cmd/agent suites pass, turbo run typecheck 7/7, poll-route tests 9/9.

Ships with the next agent release. Once it is out, the hand-set FG_NPM_TOKEN in /etc/forgegraph/agent.env can be removed — I have left it in place so the registry keeps deploying in the meantime.

🤖 Generated with Claude Code

Removes the hand-set node config that #513 depends on. #513 made the registry build able to authenticate, but the credential's only source was `FG_NPM_TOKEN` written by hand into `/etc/forgegraph/agent.env` on hetzner-fg. That is invisible, unreproducible, and silently absent on every other node — the next node to build the registry would fail exactly as this one did, with no indication why. **CI already solved this.** `fetchQueuedCIJobs` attaches a resolved registry config per repository via `resolveCIRegistryForRepository`. Deployments resolve the same `repositoryId` a few lines earlier in the poll route, so this reuses the same helper and carries the result in the payload. - **poll route** — resolve the registry alongside the repository lookup already happening, attach as `registry` - **client** — `PendingDeployment.Registry`, matching the field `CIJob` already has - **agent** — `buildEnv` exports `FG_NPM_TOKEN` for `nix build`, mirroring how `gitauth` supplies git credentials. Environment rather than argv for the same stated reason: argv is world-readable through `/proc`. Absent a configured registry the token is empty and `buildEnv` returns nil, so nix inherits the parent environment exactly as before — public flakes are untouched. **Tests** — 4 new Go tests on the env assembly: the token is carried, the parent environment is preserved when materialised, a git credential and an npm token coexist (the case that would break if either clobbered the other), and an empty token is never exported. `go build`/`vet` clean, existing `internal/deploy` and `cmd/agent` suites pass, `turbo run typecheck` 7/7, poll-route tests 9/9. Ships with the next agent release. Once it is out, the hand-set `FG_NPM_TOKEN` in `/etc/forgegraph/agent.env` can be removed — I have left it in place so the registry keeps deploying in the meantime. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(deploy): carry the registry credential in the deployment payload
All checks were successful
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m27s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 9m33s
c4f7244db8
The registry's nix build needs npm auth, and until now the only way it had
one was FG_NPM_TOKEN hand-set in /etc/forgegraph/agent.env on a single node.
That is invisible, unreproducible, and silently absent on every other node.

CI jobs already solve this: fetchQueuedCIJobs attaches a resolved registry
config per repository. Deployments resolve the same repositoryId a few lines
earlier, so this reuses resolveCIRegistryForRepository and the agent turns it
into FG_NPM_TOKEN for the nix build, the way gitauth already supplies git
credentials.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gmackie/ForgeGraph!514
No description provided.