Repository navigation
feat(deploy): smoke a target through the edge: opt in as CI, then check the version and the route - #253
Merged
Conversation
…ck the version and the route The smoke of a Preview target must go through the shared hostname (ADR-0111): the edge sends a request to the target only with a pin cookie, which it sets on /_edge/opt-in/<audience>?target=<name> for a principal Access admitted there. Without the pin the answer is production's. Part of #195 stage E; no deploy runs these yet. - scripts/edge-opt-in.sh <shared-origin> <audience> <target> <cookie-jar>: - asks with the CI opt-in service token (EDGE_CI_CLIENT_ID/_SECRET, in a 0600 header file, never argv), and writes the edge's pin (__Host-thrust_edge) to the jar; - asks again only for the refusals that time cures: the edge's "that target does not exist or is not open to you", given until the target's flag has propagated (up to 30 s), a 503, no answer; - every other answer is final: an empty-bodied Access 403, the edge's "not admitted", any other status, a 303 that sets no pin; - refuses, before asking anything, an origin that is not https, and an audience or target outside the edge's own grammar. - scripts/smoke-deploy.sh: - SMOKE_COOKIE_FILE: the pin goes with every request of both phases. The sign-in's session cookies join it in one jar, so the read reaches the same target. - SMOKE_EXPECT_ROUTE: phase 1 also needs the edge's x-thrust-route to name the target. - Without either, the smoke is unchanged. - The new name check spells its letters out: in a UTF-8 locale `[a-z]` also matches capitals. The test found it. Tests (test-smoke-deploy.sh, under dash: 54 passed, in the C and a UTF-8 locale). smoke_stub.py now also stands for the edge with one target (--pin): only a request with that target's pin reaches it, and any other gets production's version, route and an API that answers 421. Cases: - through the edge, both phases reach the target; - without the pin, production's version fails it; - another route, or no route header, fails it; - the opt-in waits out propagation and a transient 503, and gives up after its attempts; - each final refusal is final, not retried; - every usage error asks nothing; - the secret is in no curl argv and in no output (seen through the existing argv-logging curl wrapper). 11 hand mutants of the two scripts each fail it. The first run had one survivor: retrying every 403 still matched the refusal cases' fragment, so those cases now require the message only an immediate refusal prints. Also: every deps step (14) and every ci-scripts test (29), run separately with sh as dash. plan-ci.py routes edge-opt-in.sh with the other deploy scripts (test_plan_ci.py: 5024). A row in cicd.md. Refs: #195 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
The second piece of deploying release candidates as Worker Previews (#195 stage E, ADR-0111): the smoke of a target, through
the edge. No deploy runs it yet. It is independent of #241.
Why
A target is reached only through the shared hostname, and only with the edge's pin cookie:
/_edge/opt-in/<audience>?target=<name>for a principal Access admitted there.What it adds
scripts/edge-opt-in.sh <shared-origin> <audience> <target> <cookie-jar>:EDGE_CI_CLIENT_ID/_SECRET, read from a 0600 header file,never from arguments. It writes the edge's pin to the cookie jar.
own grammar.
scripts/smoke-deploy.sh:SMOKE_COOKIE_FILE: the pin goes with every request of both phases. The sign-in's cookies join it in one jar, sothe data read reaches the same target.
SMOKE_EXPECT_ROUTE: phase 1 also requires the edge'sx-thrust-routeto name the target.[a-z]alsomatches capitals.
Tests
test-smoke-deploy.sh, under dash: 54 checks pass, in both the C and a UTF-8 locale.The stub:
smoke_stub.py --pinnow stands for the edge with one target. Only a request carrying that target's pinreaches it; any other gets production's version,
x-thrust-route: prod, and an API that answers 421.What the tests show:
Hand mutants: 11 versions of the two scripts with a planted bug, and each fails the tests. The first run had one
survivor: retrying every 403 still matched the refusal cases' expected message. Those cases now require the message only
an immediate refusal prints.
Also passing:
depsstep (14);ci-scriptstest (29), each run on its own withshas dash;test_plan_ci.py(5024).Not shown locally: that the runner's curl (8.5.0) stores a
__Host-Secure cookie from127.0.0.1over http, ascurl 8.7.1 does here. This PR's
ci-scriptsjob is the check.Next
scripts/deploy-target.sh, stacked on #241:wrangler preview;flagship.py put;Refs #195
🤖 Generated with Claude Code