ci: add verified R2 artifact transport and isolated deployment canary

Merged
TE
2mo ago
+3636-0

Repeated app-host consumers download the same compiled-product artifact independently. This adds an optional, digest-verified GitHub-to-R2 transport with one import per artifact identity and the existing GitHub download path as fallback. It preserves producer/run provenance and all inner product validation; the default CI path remains unchanged.

The generic Worker has no public route. A main-only manual canary uses the repository's existing Cloudflare credentials to create one private, uniquely named Worker/bucket, admits one exact artifact through an expiring secret header, and measures one cold fill followed by one warm read. It then removes the Worker, ephemeral credentials, exact R2 copy and empty owned bucket. No repository URL or runner setting is changed. The reviewed artifact expires September 23; later trials require a reviewed identity refresh.

Validation: 19 real-workerd/gate/workflow tests plus 17 Python cases pass, including coalescing, corrupt bytes, GitHub fallback and stalled R2 head/get/put. Two mutations demonstrate that tests catch missing response deadlines and premature import ownership release. TypeScript, generic/canary dry-run bundles, actionlint and the repository runner guard pass. Integrated current main, preserving its instrumented download composite.

No live deployment or performance improvement is claimed yet. Cold import may add delay, and permanently stalled non-abortable I/O retains ownership until it actually settles. This copies origin artifacts; it does not reduce GitHub storage or deduplicate different artifact IDs. Production enablement still requires a reviewed authenticated admission policy/client integration.

Summary by CodeRabbit

  • New Features

    • Added optional, integrity-checked transport for CI artifacts through a private cache.
    • Added automatic fallback to the existing artifact download when cached transport is unavailable or invalid.
    • Added a manually triggered canary workflow to verify artifact delivery and measure cold and warm retrieval performance.
  • Documentation

    • Added setup, security, testing, monitoring, and canary usage documentation for the artifact transport service.
  • Tests

    • Added coverage for artifact validation, fallback behavior, security checks, caching, cleanup, and canary access controls.