Repository navigation
ci: wire named_keys_v1 as a docker.yml workflow input (TC-1777) - #447
Merged
Merged
Conversation
added 3 commits
October 25, 2026 20:50
named_keys_v1 (default false) is sealed into the Phala env as NAMED_KEYS_V1 beside DSTACK_AUTHORIZED_KEYS, so the flip is a normal dispatch and never a hand `phala deploy -e`. The dstack-postgres compose maps it to TINYCLOUD_ENCRYPTION_NETWORK__NAMED_KEYS_V1, sets the deletion ledger path and mounts a deletion-ledger volume; the N0 template hash is updated to match. Details: TC-1777
…edger mount in the compose proof The sealed-config preflight now passes NAMED_KEYS_V1 and the compose's deletion ledger path to --validate-config. The hosted compose proof expected the tinycloud service to mount only the dstack socket; it now also expects the deletion-ledger volume. Details: TC-1777
Contributor
Author
Contributor
Author
samgbafa
marked this pull request as ready for review
October 26, 2026 00:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details: TC-1777
What
Wires the named-keys release gate as a
docker.ymlworkflow_dispatch input, so the Tue 10-27 flip is a normal dispatch and never a handphala deploy -e(which would replace the sealed env and dropDSTACK_AUTHORIZED_KEYS)..github/workflows/docker.ymlnamed_keys_v1(boolean, defaultfalse,required: false, so every existing dispatch line stays valid unchanged);PHALA_ENV_NAMED_KEYS_V1: ${{ inputs.named_keys_v1 }}on theDeploy to Phala Cloudstep, added torequired_vars, written asprintf 'NAMED_KEYS_V1=%s\n' …right afterSQL_IDENTITY_FENCE;trueorfalse(constant error, before.phala-prod.envis written);n0_template_hash8df7e0f2…→c9bcbea9dac90fc2b74d8439146596ba802796a211d1b6d65aeda2286d7ed028.DSTACK_AUTHORIZED_KEYSline and thephala deploy … -e .phala-prod.envcall are untouched.docker-compose.dstack-postgres.yaml(tinycloudservice)TINYCLOUD_ENCRYPTION_NETWORK__NAMED_KEYS_V1: "${NAMED_KEYS_V1:-false}"TINYCLOUD_ENCRYPTION_NETWORK__DELETION_LEDGER_PATH: /var/lib/tinycloud/ledger/deletions.jsonldeletion-ledger:/var/lib/tinycloud/ledger+ top-leveldeletion-ledger:scripts/ci/fixtures/tc959-n0-compose.yaml: byte copy of the compose (it always is; the test harness hashes it againstn0_template_hash).docs/releasing.md: the pinned template hash and the raw compose hash it states (old values kept in the history chain). The historical table indocs/runbooks/tc-959-n0-log-shipping.mdis left as recorded.scripts/ci/test-deploy-recovery.py: additive only (see Tests).Findings that differ from the spec
phala-env-sync/directory exists in the repo.sync.mjsis a heredoc inside docker.yml'sPrepare allowed_envs synchronizationstep and has no hard-coded whitelist: it readsallowed_envsfrom the CVM's compose, requires every allowed name to be present in.phala-prod.env(--check), and PATCHes any name in the file but not yet allowed.NAMED_KEYS_V1therefore needs no sync.mjs change. The first dispatch carrying it adds the name through that existing PATCH path, asSQL_IDENTITY_FENCE/NODE_STATS_READ_TOKENdid. There was nothing to update in sync.mjs's tests; the deploy-step harness (test-deploy-recovery.py) is its test surface.tc1777/n3b-key-delete, 4644aaf) adds the config keyencryption_network.deletion_ledger_path(documented envTINYCLOUD_ENCRYPTION_NETWORK__DELETION_LEDGER_PATH) and refuses to start withnamed_keys_v1=trueand no ledger path, and its Dockerfile creates/var/lib/tinycloud/ledgerowned 1000:1000, mode 700, which is what makes a named volume mounted at that path writable by thetinyclouduser on first mount. Nothing is duplicated; this PR is the deploy-side counterpart. encryption: seeded deletable keys under apps/, depth rule, state guards #436 (6a94e39) only adds the key backend/routes.Preflight sealed runtime configurationstep does not passNAMED_KEYS_V1/ledger path to--validate-config, so that preflight does not exercise the flipped configuration.Default false = behaviour unchanged
For
named_keys_v1=false(every existing dispatch line, which never mention it):NAMED_KEYS_V1=false; every other line andDSTACK_AUTHORIZED_KEYSare unchanged;TINYCLOUD_ENCRYPTION_NETWORK__NAMED_KEYS_V1="false", the same as the gate's default off. The ledger path env/volume are inert for the 1.23.0/1.20.6 images (EncryptionNetworkConfighas nodeny_unknown_fields).Proof:
docker compose --env-file … configon the real compose rendersNAMED_KEYS_V1: "false"with noNAMED_KEYS_V1in the env file,"false"withNAMED_KEYS_V1=false,"true"withNAMED_KEYS_V1=true, with the ledger path anddeletion-ledgervolume (target/var/lib/tinycloud/ledger) in all three.Flip and rollback (dispatch, never
-e)Flip (use the same digest/labels as the release being run; shown for 1.24.0):
Rollback of the flag only: the identical dispatch with
-f named_keys_v1=false(same digest and rollback inputs). Omitting the input has the same effect.Tests (run locally on this head)
python3 scripts/ci/test-deploy-recovery.py: Ran 27 tests, OK (25 existing + 2 new).test_named_keys_gate_is_sealed_as_a_literal_flag_beside_the_ssh_keys(true/false sealed once,DSTACK_AUTHORIZED_KEYSkept once, sealed value equals the input) andtest_named_keys_gate_other_than_true_or_false_is_refused_before_the_file("",TRUE,1,yes,maybe,truerefused before the sealed file and before any CVM mutation).nodeCLI, one env line inrun_deploy, the two tests).actionlint .github/workflows/docker.yml: the same 2 shellcheck findings as on origin/main (SC2016 info and SC2034 warning, only line numbers shifted); nothing new.8df7e0f2…; the new compose givesc9bcbea9…(raw298ea356adf8d5e562557ab18bd3f5d8cdb816de82b1eaf6e6e50bf888e22765). The N0 path of the deploy harness passes against it.node --test log-shipper/budget.test.mjs log-shipper/profile.test.mjs scripts/tc959-docker.test.mjs scripts/tc959-readiness.test.mjs: 41 pass, 0 fail.node scripts/tc959-check.mjs: passed.docs/releasing.md). Not deployed, not merged.test-ruling: TC-1777