average-breakfast-91545
05/01/2024, 7:27 AMfoo
, further pushes to foo
are rejected.
I switched our pipeline to use {pants.hash} as the tag for our images. The first build succeeded, but a second build failed, because it tried to push to a tag that already existed.
We're using multi-stage images, to build a docker image suited to lambda, which we do by just dumping the contents of the src and deps pexes into /var/runtime
docker_image(
name="ingest",
tags=["artifact"],
image_tags=["{pants.hash}"],
source=None,
instructions=[
"FROM .<http://dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base|dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base>",
"COPY src.ingest/ingest_deps.pex /ingest.pex",
"RUN PEX_TOOLS=1 /var/lang/bin/python3.9 /ingest.pex venv --scope=deps --compile --collisions-ok --rm pex /tmp/venv-deps",
"FROM .<http://dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base|dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base>",
"COPY src.ingest/ingest_src.pex /ingest.pex",
"RUN PEX_TOOLS=1 /var/lang/bin/python3.9 /ingest.pex venv --scope=srcs --compile --collisions-ok --rm pex /tmp/venv-srcs",
"FROM .<http://dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base|dkr.ecr.eu-west-2.amazonaws.com/python-lambda-base>",
"COPY --from=0 /tmp/venv-deps/lib/python3.9/site-packages/ /var/runtime",
"COPY --from=1 /tmp/venv-srcs/lib/python3.9/site-packages/ /var/runtime",
],
)
When pushing the image, it seems that we're always pushing the last two layers, even if the same pexes, read from cache, are used as inputs. The pants.hash matches, so I'm guessing that the inputs are exactly the same. Why is Docker deciding that these are new, different, layers that need pushing?broad-processor-92400
05/01/2024, 7:43 AMpex venv
• just confirming outside pants , does it work to do a second push of something that’s already been pushed? (ie does ECR accept a second push if it is exactly identical or does block all second pushes, without checking content)average-breakfast-91545
05/01/2024, 7:45 AMnutritious-hair-72580
05/02/2024, 1:20 AMnutritious-hair-72580
05/02/2024, 1:21 AMaverage-breakfast-91545
05/02/2024, 6:54 AMLayer already exists.
The issue is that for the last couple of layers, the layer does not exist, even though (in theory) the image is exactly the same as the previous run. I'll give the source epoch a go and see if that makes any difference.