Skip to content

ci: deploy to CDN from GitHub Actions via OIDC - #1392

Open
abueide wants to merge 3 commits into
masterfrom
restore-buildkite-cdn-release
Open

ci: deploy to CDN from GitHub Actions via OIDC#1392
abueide wants to merge 3 commits into
masterfrom
restore-buildkite-cdn-release

Conversation

@abueide

@abueide abueide commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Update: this PR originally restored the Buildkite CDN pipeline (reverting #1391). The ADR for CDN deploy has since been approved for GitHub Actions + OIDC directly instead, per GitHub's documented pattern:
https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws

So this now removes .buildkite/pipeline.yml again and adds a deploy-cdn job to publish.yml that assumes ajs-private-assets-upload directly via aws-actions/configure-aws-credentials (OIDC) - no Buildkite, no cluster secrets, no BUILDKITE_API_TOKEN needed.

Design

  • deploy-cdn runs after publish (npm), gated on the same production GitHub Environment that already manually-approves npm publish - one approval covers both.
  • Uses the existing packages/browser release:cdn script unchanged (yarn . build && NODE_ENV=production bash scripts/release.sh && NODE_ENV=stage bash scripts/release.sh) - only how AWS credentials are obtained has changed.

Confirmed values

  • Upload role: arn:aws:iam::812113486725:role/ajs-private-assets-upload (account plat, owned by cdp-infra)
  • PROD_BUCKET: segment-ajs-renderer-compiled-production - confirmed via chamber read analytics-next prod_bucket

Still blocked on

  • cdp-infra reviewing/applying the paired trust-policy PRs: segmentio/terracode-all-accounts#1650 and segmentio/terracode-platform#93 (registers GitHub's OIDC provider in the plat account and trusts it on ajs-private-assets-upload, scoped to repo:segmentio/analytics-next:environment:production)
  • Filling in STAGE_BUCKET/*_CDN_OAI/*_CUSTOM_DOMAIN_OAI/*_SHADOW placeholders from chamber read analytics-next <key>

Already done (outside this PR)

cdp-analytics-next's leftover GitHub webhook (which was auto-triggering broken Buildkite builds on every push) was disabled directly via the Buildkite API. That pipeline is left disabled rather than deleted, in case it's useful as a reference, but nothing further is planned for it.

Test plan

  • Fill in remaining env var placeholders
  • cdp-infra approves + applies the trust-policy PRs
  • Run one real end-to-end release as a genuine first test - this path has never succeeded even once

Un-reverts #1391 - architects are still evaluating whether GHA can
deploy to S3 under a new proposal, so Buildkite is the safe path for
now.

Auth is redesigned from the original #1382 draft: that version fetched
a Buildkite cluster secret (`analytics-next-cdn-release`) that was
never actually provisioned, then did a plain `aws sts assume-role`
relying on a Segment-fleet ambient identity (`SEGMENT_CONTEXTS`) that
doesn't exist on Twilio's Buildkite agents. This version instead
follows Twilio's documented OIDC pattern (buildkite-agent oidc
request-token + sts assume-role-with-web-identity) - no ambient
identity or cluster secret dependency.

The upload role (arn:aws:iam::812113486725:role/ajs-private-assets-upload,
owned by cdp-infra) and PROD_BUCKET are confirmed real values, recovered
from the last successful legacy Buildkite build. The remaining env vars
(STAGE_BUCKET, *_CDN_OAI, *_CUSTOM_DOMAIN_OAI, *_SHADOW) are placeholders
pending a chamber read.

Still blocked on:
- cdp-infra adding a trust statement to ajs-private-assets-upload for
  Twilio Buildkite's OIDC issuer, scoped to this pipeline/branch
- BUILDKITE_API_TOKEN repo secret (write_builds on cdp-analytics-next)
- filling in the remaining chamber-sourced env vars above

cdp-analytics-next's leftover GitHub webhook (build_branches/
build_pull_requests) has already been disabled directly via the
Buildkite API, so this trigger step is now the only thing that can
start a build there.
@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2b51410

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.59%. Comparing base (6cd4068) to head (145ee1a).

⚠️ Current head 145ee1a differs from pull request most recent head 2b51410

Please upload reports for the commit 2b51410 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1392   +/-   ##
=======================================
  Coverage   91.59%   91.59%           
=======================================
  Files         127      127           
  Lines        4142     4142           
  Branches     1033     1033           
=======================================
  Hits         3794     3794           
  Misses        348      348           
Flag Coverage Δ
browser 92.51% <ø> (ø)
core 90.07% <ø> (ø)
node 89.43% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

abueide added 2 commits July 31, 2026 11:26
ADR approved GHA + OIDC directly for CDN deploy, per GitHub's documented
pattern:
https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws

Removes .buildkite/pipeline.yml and the Buildkite-API trigger step added
in this branch's earlier commits. Adds a deploy-cdn job to publish.yml
that assumes ajs-private-assets-upload directly via
aws-actions/configure-aws-credentials (no Buildkite, no cluster secrets,
no BUILDKITE_API_TOKEN needed) and runs the existing release:cdn script.

Scoped to the same `production` GitHub Environment that already
manually-gates npm publish, so both share one approval gate.

Still blocked on:
- cdp-infra reviewing/applying the paired trust-policy PRs
  (terracode-all-accounts#1650, terracode-platform#93)
- filling in the remaining chamber-sourced env var placeholders
  (STAGE_BUCKET, *_CDN_OAI, *_CUSTOM_DOMAIN_OAI, *_SHADOW)

cdp-analytics-next's Buildkite pipeline is left disabled (webhook already
turned off) rather than deleted outright, in case it's still wanted as a
reference - no further action needed there.
Follow-up to the previous commit - the .buildkite/pipeline.yml deletion
landed but this file's changes didn't get staged.
@abueide abueide changed the title ci: restore Buildkite CDN release pipeline with OIDC auth ci: deploy to CDN from GitHub Actions via OIDC Jul 31, 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.

1 participant