Skip to content

ECR: implement layer upload APIs - #10195

Open
JonnasFigueiredo wants to merge 1 commit into
getmoto:masterfrom
JonnasFigueiredo:feature/ecr-layer-upload
Open

ECR: implement layer upload APIs#10195
JonnasFigueiredo wants to merge 1 commit into
getmoto:masterfrom
JonnasFigueiredo:feature/ecr-layer-upload

Conversation

@JonnasFigueiredo

Copy link
Copy Markdown

Summary

Implements the ECR image-layer push flow, which previously raised NotImplementedError:

  • InitiateLayerUpload
  • UploadLayerPart
  • CompleteLayerUpload
  • BatchCheckLayerAvailability

Behavior

  • InitiateLayerUpload returns an uploadId and an advisory partSize.
  • UploadLayerPart accumulates the (base64-decoded) layerPartBlob per upload and returns lastByteReceived.
  • CompleteLayerUpload derives the layer digest from the uploaded bytes (sha256:...), stores the layer on the repository, and returns layerDigest. An unknown uploadId raises the new UploadNotFoundException.
  • BatchCheckLayerAvailability returns stored layers as AVAILABLE (with layerSize / mediaType) and reports MissingLayerDigest / InvalidLayerDigest failures otherwise.

This makes it possible to exercise image-push style workflows (initiate → upload part(s) → complete → check availability) against mocked ECR.

Tests

tests/test_ecr/test_ecr_layers.py covers the full single-part and multi-part push flow, availability checks (present / missing / invalid digest), and the unknown-upload error cases. The complete tests/test_ecr suite passes, and mypy, ruff, and black are clean on the changed files.

Implements the ECR image-layer push flow that previously raised
NotImplementedError:

- initiate_layer_upload
- upload_layer_part
- complete_layer_upload
- batch_check_layer_availability

InitiateLayerUpload returns an uploadId and part size; parts are accumulated
per upload and CompleteLayerUpload derives the layer digest from the uploaded
bytes (sha256) and stores the layer on the repository. BatchCheckLayerAvailability
reports AVAILABLE layers and returns MissingLayerDigest/InvalidLayerDigest
failures otherwise. Adds an UploadNotFoundException for unknown upload ids and
acceptance tests covering the full flow and error cases.
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