Repository navigation
feat(aws-lambda): push a prebuilt image to ECR without Docker - #6063
Open
miguel-heygen wants to merge 4 commits into
Open
miguel-heygen wants to merge 4 commits into
miguel-heygen wants to merge 4 commits into
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 159 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
4 of 5 tasks
Adds pushImageToEcr and ensureEcrRepository to the SDK subpath. The push reads a single-platform OCI image layout, verifies every blob against its descriptor before any ECR call, uploads only the blobs ECR lacks through the layer-upload API, and puts the manifest under a tag, returning the digest-pinned image URI.
Like the other AWS SDK clients, @aws-sdk/client-ecr is a dependency the consumer resolves. Bundled into the ESM SDK it hits a dynamic require of node:https and the packed package fails to import.
miguel-heygen
force-pushed
the
feat/lambda-ecr-push
branch
from
October 22, 2026 16:21
58562b8 to
a452395
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two functions to
@hyperframes/aws-lambda/sdk:ensureEcrRepository({ ecr, repositoryName, tags? })creates the ECR repository, or returns the existing one's URI when it already exists.pushImageToEcr({ ecr, layoutDir, repositoryName, repositoryUri, tag, log? })pushes a prebuilt single-platform OCI image layout (a directory) into that repository and returns{ imageUri, digest, architecture, os }, whereimageUriis<repositoryUri>@sha256:<manifest digest>.Adds the
@aws-sdk/client-ecrdependency on the same^3.1146.0line as the other AWS SDK clients. No CLI wiring yet; callers come in a follow-up.Why
The arm64 video function will ship as a container image, and Lambda only runs images from the account's own private ECR. Users of the released CLI should not need Docker to get it there. The release will publish the image as an OCI layout; this function moves that layout into the user's ECR with the ECR API alone (no Docker, no registry HTTP calls).
Related work
First piece of the container-image deploy path. Nothing else touches ECR yet.
How
index.jsonmust list exactly one image manifest (OCI or Docker v2 schema 2). An image index, attestation manifests, or zero or several manifests throw an error naming what was found.architectureandos; both are returned so the caller can assert the platform it expects.BatchCheckLayerAvailabilityin batches of at most 100 digests; only blobs notAVAILABLEare uploaded:InitiateLayerUpload, parts of exactlypartSizebytes read from disk one part at a time (inclusivepartFirstByte/partLastByte), thenCompleteLayerUpload.LayerAlreadyExistsExceptioncounts as uploaded.PutImagesends the manifest's exact bytes, its media type, the tag and the digest.ImageAlreadyExistsExceptioncounts as success, so a redeploy of the same image is a no-op.bun.lock: besides the new entry,bun installrefreshed the stale workspace version fields and dropped an unuseddate-fnsentry.Test plan
pushImageToEcr.test.tsruns the real code path against an in-memory ECR that behaves like ECR where it matters. It tracks uploads per upload id, rejects out-of-order or non-contiguous parts, a wrongpartLastByte, or a short non-final part, re-hashes the assembled bytes onCompleteLayerUpload, rejectsPutImagewhen a referenced blob is missing, and caps availability checks at 100 digests. The fixture layout is built in a temp dir: one config, a 21-byte layer and a 17-byte layer, with a 7-byte part size.bun test src/sdk/pushImageToEcr.test.ts: exit 0, 11 pass / 0 fail, three runs in a row.bun test src/handler.test.ts: exit 0, 31 pass / 0 fail.tsc --noEmitinpackages/aws-lambda: exit 0. oxlint: 0 warnings, 0 errors. oxfmt--check: clean.partLastByteoff by one: the 5 tests that upload went red.LayerAlreadyExists,ImageAlreadyExistsorRepositoryAlreadyExists: in each case only the matching test went red.