Repository navigation
feat(aws-lambda): attach the arm64 video image to releases and pin it - #6070
Conversation
somanshreddy
left a comment
There was a problem hiding this comment.
Reviewed at 2fc197a2 (delta over feat/lambda-arm64-image). No blockers.
Checked
- Gate wiring:
lambda-arm64-ffmpeguses the sameif:and the sameEXPECTED_RELEASE_SHAcheckout aspublish, soneeds:can't skippublishon a trigger the ffmpeg job doesn't run on. The job hascontents: readonly, and an ARM failure stops the release before the tag/release/npm steps. - Artifact name:
build-ffmpeg.shwrites/out/hf-media-linux-$(uname -m).tar.gz, which isaarch64onubuntu-24.04-arm. That matches the upload path and the--ffmpeg=path inpublish. - No-emulation build: the
videostage isFROM ${BASE}plus a singleCOPY --from=task, with noRUN, so building--platform linux/arm64on the x86 runner holds.--provenance=false --sbom=falsekeepsindex.jsonto one manifest. - Cache trust: the save happens only when
github.ref == 'refs/heads/main'(copya). PR runs oflambda-arm64-image.ymlcan't write into main's scope, and release runs (PR-closed or prerelease tag) restore from main. On a hit, the codec check is skipped, butstage-arm64-image.tsstill enforces the arm64 ELF check. - Retry: an existing release asset is downloaded and re-pinned, and the attach step is skipped. On a fresh build, the image comes from the same
dist/hyperframes-lambda-handler.zipthe ZIP pin used. - Pin refactor: the
${asset.split(".")[0]}.sha256sidecar giveshyperframes-lambda-handler.sha256, so the ZIP sidecar name is unchanged, andhyperframes-lambda-video-arm64.sha256for the image.filesalready shipsprebuilt/, sovideo-image.jsongoes into the package and the tarball doesn't.
Non-blocking
- On a push to
main, copyasaves the cache in its own job, before anything checks that copies a and b match. The codec check has still run (artifactdepends oncheck), so the only thing a release could inherit is an unreproduced-but-checked tarball. Fine as is; to be stricter, save only after the a == b comparison. - The
actdry run is still unchecked in the test plan. The first real release is the end-to-end test of the OCI export and upload, so it's worth watching the release job's timing against the new 30-min timeout.
— Somu
003729a to
b1f62bb
Compare
2fc197a to
6053c59
Compare
b1f62bb to
325339f
Compare
The base branch was changed.
The release builds the arm64 video function image from the handler ZIP it attaches, attaches it as an OCI layout tarball with its sha256, and pins it in prebuilt/video-image.json, read through prebuiltVideoImage(). A retried release reuses the image already attached.
0859e96 to
fe4b485
Compare
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head 2008aeab
- blocker — CI
Buildfails at this head:verify:packed-manifestsreports@hyperframes/aws-lambdapacked 71201 B > budget 70874, unpacked 259303 B > 258166 (scripts/package-size-budgets.json:3-4). Main at the basef6cbf87cpassesBuild, so the overage comes from this PR's SDK additions.publish.ymlruns the same step before tagging, so the release would fail there too. Fix: raise the aws-lambda budget and say why in the PR body, as the check's message asks.
Scope
Code is the same as the dismissed approval at 2fc197a2. I compared the patches after the rebase and only context lines changed. I re-read all 6 files: the job gate and checkout match publish, the cache key and path match across both workflows, the stage-script args and video target are copy-only, the retry reuse path still pins the attached image, .sha256 naming works for both assets, and prebuilt/ is in files. Other workflows at this head are green; Windows render verification was still running when I posted.
…kage pin-handler-zip.ts is run from a checkout by publish.yml; nothing in dist or the CLI imports it. Leaving it out keeps aws-lambda under its size budget with the video image reader added.
fe4b485 to
e409d84
Compare
There was a problem hiding this comment.
Verdict: APPROVE · 1 resolved, 0 open, 0 new · 2008aeab → e409d84f
✅ The Build size-budget blocker is fixed in e409d84f. !scripts/pin-handler-zip.ts keeps the script out of the tarball. Only publish.yml and tests use it, from the repo checkout, and no shipped file imports it. All workflows at this head are green, including CI/Build.
What
Every release attaches the arm64 Lambda video function image as an OCI layout tarball,
hyperframes-lambda-video-arm64.oci.tarwith its.sha256, and@hyperframes/aws-lambdapins it (URL, sha256, bytes, version) inprebuilt/video-image.json. A new SDK function,prebuiltVideoImage(), reads that pin. Stacked on #6064.Nothing consumes the pin yet: the CLI option that pushes the image and deploys it comes next. The x86 ZIP deploy is untouched.
Why
A released CLI must be able to deploy the arm64 video function without a repo checkout or a Docker build on the user's machine, the same way it deploys the handler ZIP today. That needs a prebuilt image whose bytes the npm package pins.
How
publish.ymlgainslambda-arm64-ffmpegonubuntu-24.04-arm. It has the same releaseif:and the same immutable checkout aspublish, and onlycontents: read. It builds build(aws-lambda): pinned native ffmpeg build for an arm64 Lambda image #6062's ffmpeg artifact and uploads the tarball as a workflow artifact.publishnowneedsit, so a failed ARM build stops the release before anything is tagged or published.packages/aws-lambda/image/**.lambda-arm64-image.ymlnow also runs on pushes tomainthat touchimage/**, and copyasaves the same key there. Releases then compile only when the recipe changed and that push's run has not finished yet. A re-run of the same release also hits its own first attempt's save.main(or this release's first attempt). Onmainthat islambda-arm64-image.yml, which built it from the same recipe and ran the codec check. A hit skips the compile and its codec check.stage-arm64-image.tsstill refuses ffmpeg or ffprobe binaries that are not arm64 ELF.publish, right after the handler ZIP is pinned, the image is staged from that ZIP (dist/hyperframes-lambda-handler.zip) and the ARM tarball withstage-arm64-image.ts.videostage is built forlinux/arm64on the x86 runner, with no emulation.--output type=ocifrom adocker-containerbuildx builder, with--provenance=false --sbom=false, soindex.jsonlists exactly one image manifest.pin-handler-zip.ts's hashing is nowpinReleaseAsset(repoRoot, asset, manifestFile), which writes the.sha256sidecar and the manifest. The ZIP keeps its move-and-template step on top of it, and--video-imagepins the image.HandlerZipManifestis renamedReleaseAssetManifest, since both pins share that shape.publish's timeout goes from 20 to 30 minutes for the base image pull, the staging (Chrome arm64 pack download) and the image upload.Test plan
bun test scripts/pin-handler-zip.test.ts: 7 pass, 0 fail, exit 0, three runs in a rowprebuiltHandler,deploy,stackCheck): 11 passed, exit 0, three runs in a rowprebuiltVideoImagereads the handler manifest: the image pin test and the "no image when only the zip is pinned" test fail.sha256sidecar name drops-arm64: the image pin test failstsc --noEmitfor the package,actionlinton both workflows: cleanact, cut before "Create GitHub Release" (no release, no upload, no npm publish)