test(config): pin the encryption block and key mount in every rig (S04-A required encryption block plan: 4/16)
Summary
Every rig that boots the service now has a test that fails when the rig
loses the encryption block. Step 12 makes the block required, and this pin
keeps the rigs ready for it.
internal/config/encryption_rigs_test.go:TestRigsCarryTheEncryptionBlockranges overdevelopmentModeRigs(the run recipe and the three conformance scripts). Each rig must writeencryption:withlocal: {}at its indent. A commented-out or re-indented block fails.- The Caproni e2e values are one more case. They boot with an
iamblock, so they are not ondevelopmentModeRigs. The case also decodessecretVolumesand checks that it mountsar-encryption-root-keyat/secrets/infrastructure/encryption, where the local topology reads the root key. internal/config/authorization_test.go: thedevelopmentModeRigsdoc comment names this test, so whoever takes a rig off that list sees that it needs its own case here.
The pin is green on main: !3052 (merged), !3321 (merged) and !2052 (merged) already put the block in
every rig. No production code changes.
Governing ADRs
None. ./scripts/adr-freshness.sh reports the mirror current. ADR-007
describes the key tables, not rig config. ADR-020 and ADR-021 describe the
development mode a rig may run. This MR changes no rig's mode: the Caproni
rig already runs with an iam block on main. ADR-020's wording about which
rigs run development mode is in handbook draft
gitlab-com/content-sites/handbook!21574 (closed),
and nothing here depends on it. The plan's research found that the two
internal ADRs do not touch encryption.
Testing
go test ./internal/config/passes, both rig pins included.golangci-lint run ./internal/config/...reports 0 issues, and the comment caps check passes.
Each mutation below was applied, re-run, and restored. Each one failed only its own rig's subtest:
| Mutation | Fails |
|---|---|
encryption: deleted from driver.sh |
the driver.sh subtest |
local: {} re-indented in run.sh |
the run.sh subtest |
the block commented out in npm-e2e.sh |
the npm-e2e.sh subtest |
the block removed from maven_setup.sh |
the maven_setup.sh subtest |
| the block commented out in the Caproni values | the Caproni subtest |
the mount path changed, the Secret renamed, or the entry moved out of secretVolumes |
the Caproni subtest |
No e2e scenario is added. The pin checks repository files, and nothing a client can observe changes.
Spec coverage
| Rule | Tests |
|---|---|
| Configuration: no "encryption off" mode, including in development mode | TestRigsCarryTheEncryptionBlock, one subtest per rig |
| Configuration: development and CI rigs supply their own root key | the Caproni mount, in the same test. The script rigs write their own key file: driver_test.sh covers the run recipe, and the conformance jobs boot each script with the block, which fails boot without a key (E-2) |
| Configuration: the block is required (AC-28, E-1) | Step 12. TestLoad_Encryption_AbsentBlockYieldsZeroValue still asserts today's behavior |
AC-25: all tests pass with -race |
internal/config passes |
The pin does not read config.example.yaml. Plain air copies it outside
Caproni edit mode, and its block is commented out. Step 12 owns that file.
Every other AC, E and S row: not this step.
Plan and spec amendments
The plan measured the rigs at 78fddbba8. Two e2e MRs landed after that,
and Steps 3 and 4 now say what shipped:
- Step 3 shipped through !2919 (merged) (the vendored
artifact-registry-secretschart seeds the root key Secret) and !2052 (merged) (the block and the mount in the Caproni values). Step 3's Files, Acceptance and Tests, its dependency-table row, the Verification bullet and Status row 3 say so.caproni-up.shhas no key code, so they do not name it. - Step 4 roots on
main, not on a Step 3 branch: its Depends on line, the dependency table and the join list. developmentModeRigsholds four rigs, because !2052 (merged) took the Caproni values off it. Step 4's Files entry and the rig-pin accepted smell say the pin adds the Caproni values as one more case, and name the coupling. Step 4's Files entry lists theauthorization_test.godoc comment, and its shared-seam line asks !2970 (merged) to keep that comment when it moves the list.- Step 4's Files entry said the Caproni job has no schedule. It runs daily on
main, and on most merge requests the three Caproni jobs are manual and do not block. So on those merge requests this pin is the only blocking check of the block and the mount. Other unit tests undere2e/read the same values file for other keys.
The Research Findings keep their five-rig and no-schedule bullets, because
both held at 78fddbba8, the commit they are pinned to.
Overlaps
No merge order is needed. Steps 1 to 3 are on main.
- !3343 (merged) (Step 8) edits the plan's Status table. It already conflicts with
mainon rows 7 and 8, so it needs a rebase either way. This branch edits rows 3 and 4. Rows 5 to 7 sit between them, so the two do not conflict once !3343 (merged) rebases. - !2970 (merged) (draft) moves
developmentModeRigsand deletesauthorization_test.go. It already has a modify/delete conflict on that file withmain. This MR adds one doc-comment line there, which the rebase carries intodevelopment_mode_test.go.
Closes https://gitlab.com/gitlab-org/ops/artifact-registry/-/work_items/1480