Skip to content

Fix staging and prod deployment - #381

Open
aram356 wants to merge 61 commits into
mainfrom
fix/fastly-environment-store-selectors
Open

aram356 wants to merge 61 commits into
mainfrom
fix/fastly-environment-store-selectors

Conversation

@aram356

@aram356 aram356 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Problem and resulting behavior

PR #344 made Fastly store selection depend on a shared edgezero_runtime_env Config Store and service/version-scoped descriptor keys. That added mutable shared state, put Fastly service IDs into configuration names, and made application runtime code participate in deployment-target selection.

This change removes that descriptor architecture. Applications keep stable logical store IDs in edgezero.toml. The selected deployment environment chooses physical Config, KV, and optional Secret Stores through canonical EDGEZERO__STORES__...__NAME variables. Before publication, managed Fastly deployment binds those physical resources to the logical aliases on the unpublished service version.

Production and staging can select the same or different physical stores while deploying the same immutable application release. A logical Config Store always uses its logical ID as the entry key. For example, production and staging can select config-prod and config-stage, while both versions expose the alias and key app_config.

Changes

  • Remove edgezero_runtime_env, runtime descriptors, service/version selector keys, staging selector stores, EDGEZERO_FASTLY_BUILD_SETTINGS, and all compatibility behavior for the Support optional typed secret paths and Fastly store mappings #344 contract.
  • Resolve physical stores from canonical __NAME variables and reject present blank or invalid selectors before provider I/O.
  • Reconcile declared Fastly resource links by kind and logical ID while preserving undeclared inherited links. Parse the live API types config, kv-store, and secret-store.
  • Invoke Fastly CLI through the supported service resource-link ... and service version ... hierarchy, removing per-call deprecation warnings while retaining the reviewed 15.1.0 pin.
  • Use authoritative Fastly environment records for staging state. A staging record's shadow service ID is accepted; its exact environment name, active version, and global uniqueness determine state.
  • Reject an orphan editable draft beside a staged source instead of treating it as the first-deployment draft.
  • Replace the Fastly version self-diff dependency with normalized reads of versioned domains, backends, health checks, logging endpoints, and settings. Canonicalize JSON object-key order recursively before sorting collection snapshots so provider response ordering cannot create false drift. Logging snapshots use the live REST endpoint kinds, including pubsub, logentries, and s3; they never request the invalid googlepubsub path. Verify the source, fresh clone, post-mutation draft, and final readback without calling the Compute-incompatible diff endpoint.
  • Revalidate links, package identity, source state, draft state, and protected Compute configuration immediately before publication.
  • Keep the application CLI, complete edgezero.toml, and package bytes identical across publishers and targets. A release includes and digests only the selected adapter manifest at its declared relative path.
  • Scope targeted config push/diff --adapter <name> validation to the selected adapter while retaining whole-project config validate.
  • Move immutable-release packaging and verification into provider-neutral action/Rust cores. The Fastly package action is named package-application-release-fastly and supplies only Fastly policy.
  • Refactor the existing deploy-core/scripts/run-app-cli.sh in place. It owns exact argv execution, confinement, environment scrubbing, mutation signalling, and exit propagation; thin Fastly wrappers own Fastly arguments, credentials, and output policy.
  • Colocate Fastly lifecycle smoke fixtures and assertions in deploy-fastly/tests.
  • Rename the archive produced by build-app-cli to app-cli.tar while preserving the configurable artifact name, application binary/package names, and immutable member cli/app-cli.tar.
  • Retain uploaded application CLI and release artifacts for 14 days.
  • Add a provider-neutral setup-rust-build-cache action for release producers. Its required app-name scopes Cargo dependency sources and optional Cargo target artifacts to one application, while sccache reuses compiler outputs across later native and WASM builds. Existing build commands remain unchanged.
  • Probe every lifecycle command and action-owned flag before assigning lifecycle_protocol: 1, and bind every lifecycle action to the selected source revision.
  • Keep action tooling free of Python and pip. Shell scripts use documented purpose, input, and output contracts.
  • Document custom Fastly entrypoint migration, cross-repository immutable release retrieval, mutable-config recovery, and the distinction between a real application domain and its GitHub Environment name.

Fastly does not expose a publication compare-and-swap token. Deployments and other version mutators for one service must share caller-side serialization. The source/clone and final snapshot checks reject observed interference; serialization closes the remaining provider time-of-check/time-of-use window.

Downstream consumers of the build action must consume app-cli.tar.

Closes #380

Validation

  • cargo test --locked --workspace --all-targets
  • Independent workspace tests, cli tests, axum tests, and app-demo tests CI checks; isolated adapter CLI suites pass Axum 38, Cloudflare 53, Fastly 304, and Spin 126 tests, with 111 Axum runtime tests
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • Fastly CLI-only and no-default-feature Clippy checks
  • cargo check --workspace --all-targets --features "fastly cloudflare spin"
  • Cloudflare, Fastly, and Spin WASM target checks
  • cargo fmt --all -- --check and git diff --check
  • .github/actions/deploy-core/tests/run.sh — 589 passed, 0 failed, 5 expected platform skips
  • .github/actions/setup-rust-build-cache/tests/run.sh
  • Warm Linux release-producer CI restored both app-scoped source and target caches: fixture-release fell from 1m50s to 32s and store-free-release from 2m5s to 33s; their real Cargo release builds completed in 7.09s and 7.77s, and every downstream deployment smoke passed
  • .github/actions/release-core/tests/run.sh
  • .github/actions/package-application-release-fastly/tests/run.sh — Linux test is exercised by CI; non-Linux runners skip it
  • ShellCheck for changed action scripts and actionlint for the changed workflow
  • Documentation format and lint
  • App-demo workspace tests and Clippy
  • rg 'edgezero-cli\\.tar' returns no product-contract references
  • Action and CI paths contain no Python setup, interpreter call, or pip invocation

@aram356 aram356 self-assigned this Sep 16, 2026
@aram356 aram356 changed the title fix(fastly): apply canonical store selectors at deploy feat(fastly): scope runtime configuration to service versions Sep 17, 2026
@aram356 aram356 changed the title refactor(fastly): use logical version resource links refactor(fastly): replace runtime selectors with logical resource links Sep 18, 2026
@aram356 aram356 changed the title refactor(fastly): replace runtime selectors with logical resource links fix(fastly): select runtime stores from the deployment environment Sep 18, 2026
@aram356 aram356 changed the title fix(fastly): select runtime stores from the deployment environment fix(fastly): bind stores selected by the deployment environment Sep 18, 2026
@aram356 aram356 changed the title fix(fastly): bind stores selected by the deployment environment Fix staging and prod deployment Sep 19, 2026
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.

Bind Fastly stores selected by each deployment environment

1 participant