Skip to content

ci: add a Twilio Buildkite pipeline for CDN release#1382

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

ci: add a Twilio Buildkite pipeline for CDN release#1382
abueide wants to merge 6 commits into
masterfrom
buildkite-cdn-release

Conversation

@abueide

@abueide abueide commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a minimal Buildkite pipeline scoped to CDN release only. CI/test and npm publish stay on GitHub Actions where they already work; this piece specifically needs to live on Buildkite per internal policy on where infra deploys are allowed to run.

release.yml's publish job (GitHub Actions) is the only thing that triggers a build on this pipeline, right after a successful npm publish - there's no separate webhook, so npm publish and the CDN release can't happen independently of each other.

Still needed before this is live

  • A Buildkite cluster secret with the real upload role ARN and bucket/CDN config (placeholder name/keys only right now)
  • A BUILDKITE_API_TOKEN repo secret for the trigger step
  • Confirming the upload role's trust policy actually permits assumption from this pipeline's identity

Test plan

  • Provision the secret + token above
  • Trigger a real release and confirm both npm publish and the CDN build fire together

Publishing built bundles to the CDN means writing to S3/CloudFront
infrastructure in Segment's own AWS account. Twilio's GitHub Actions
acceptable-use policy is explicit that infra deploys never run on GHA,
so this can't live next to npm publish (release.yml) - it needs its
own home on Buildkite, scoped to just this one step.

Auth follows the pattern confirmed working on segmentio/ajs-renderer's
own Twilio Buildkite migration: an ambient Twilio-account identity
(SEGMENT_CONTEXTS: aws-credentials) assumes a role that lives in
Segment's account via a plain `aws sts assume-role` call. This
replaces the old release.sh, which sourced a Segment-Buildkite-only
helper (SEGMENT_LIB_PATH/run-with-role) that has no equivalent on
Twilio agents - that's the concrete reason CDN release stopped working
partway through the original migration attempt.

Several pieces are flagged inline as unconfirmed rather than guessed at
silently: whether AJS_PRIVATE_ASSETS_UPLOAD's trust policy already
permits assumption from this identity, and the actual bucket/OAI/role
values, which need to be provisioned as a Buildkite cluster secret
before this can run for real. The pipeline object and its GitHub
webhook also still need to be created and connected - this PR is the
code side only.
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 74246b5

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

@tvs-twilio-segment

tvs-twilio-segment Bot commented Jul 17, 2026

Copy link
Copy Markdown

✅ TVS Validation Passed

View full report

Show details

All validation checks have successfully completed.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.59%. Comparing base (b4fd75d) to head (89d50f9).

⚠️ Current head 89d50f9 differs from pull request most recent head 74246b5

Please upload reports for the commit 74246b5 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1382   +/-   ##
=======================================
  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.

didiergarcia
didiergarcia previously approved these changes Jul 17, 2026
abueide added 2 commits July 17, 2026 14:15
Previously these were two independently-triggered systems that happened
to share a gate condition (same "Version Packages" commit-message
check) - but nothing actually coupled them. release.yml's
workflow_dispatch bypasses that message check entirely for manual
runs, and the Buildkite pipeline had no equivalent manual-override
path, so a manual npm release would never fire a CDN release. There
should never be a situation where one happens without the other.

Removes the GitHub webhook driving Buildkite off generic pushes, and
adds a "Trigger CDN release build" step to release.yml's publish job
that calls the Buildkite REST API directly right after npm publish and
GitHub release creation succeed. release.yml is now the only thing
that ever creates a build on cdp-analytics-next - the pipeline no
longer builds off push events at all, only explicit API-triggered
builds (from release.yml, or a human manually creating one to retry).

Needs a new repo secret, BUILDKITE_API_TOKEN, scoped to write_builds
on cdp-analytics-next - I can't provision this myself.

If the trigger step itself fails, npm has already published but the
CDN release was never kicked off - that's a real, visible failure
mode this doesn't eliminate (two independent systems can't be made
atomic from one side), but it does make it loud: the publish job goes
red, and a human needs to either re-run this step or manually trigger
a build on cdp-analytics-next rather than the two silently drifting
apart.
abueide added 3 commits July 17, 2026 17:40
Recovered arn:aws:iam::812113486725:role/ajs-private-assets-upload from
the last real, successful legacy Buildkite build of this exact step
(segment/analytics-next build #51166) - not guessed. It's a different
Segment account (812113486725) than the 528451384384 account
ajs-renderer's own buildkite-agent role lives in, which is why
guessing based on that role alone wouldn't have found it.

Also confirmed PROD_BUCKET's real value (segment-ajs-renderer-compiled-
production, via chamber read analytics-next prod_bucket, cross-checked
against the same build log) - documented in the header alongside the
still-unconfirmed keys.

Still unconfirmed: whether this role's trust policy actually permits
assumption from Twilio Buildkite's ambient identity. Two human roles in
528451384384 (dev-write, ops-write) were directly tested and confirmed
NOT able to assume it - it was only ever used by Segment's own legacy
Buildkite v1 CI identity historically. This needs an actual on-agent
test run to know either way.
Public repo - detailed rationale, account IDs, and role names belong in
internal docs, not committed comments. Pulls the role ARN back out of
the pipeline file too (sourced from the Buildkite secret instead).
@abueide abueide changed the title ci: add a Twilio Buildkite pipeline for CDN release only ci: add a Twilio Buildkite pipeline for CDN release Jul 17, 2026
@abueide
abueide enabled auto-merge (squash) July 17, 2026 22:46
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.

2 participants