zenika-open-source / terraform-aws-cli

Minimal & lightweight docker image including AWS and Terraform CLI
https://hub.docker.com/r/zenika/terraform-aws-cli
Apache License 2.0
61 stars 49 forks source link

failed to compute cache key #81

Open udoyen opened 1 year ago

udoyen commented 1 year ago

I am trying to set the versions for terraform and aws cli but I keep getting the following error:

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref kzt9knyl0fyf2cf45s1s4vhek::r6u9iqhmmazdl2yv8u6qoi0hb: "/security/awscli-exe-linux-x86_64-2.12.2.zip.sig": not found

Platform: WSL on Windows 11 Editor used: VSCode

Full error message:

[george@udoyen-hp terraform-aws-cli]$ ./dev.sh $AWS_CLI_VERSION $TERRAFORM_VERSION
Linting Dockerfile...
Lint Successful!
Building images with AWS_CLI_VERSION=2.12.2 and TERRAFORM_VERSION=1.5.6...
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.88kB done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 264B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/debian:bookworm-20230612-slim
#3 DONE 2.4s

#4 [internal] load build context
#4 DONE 0.0s

#5 [aws-cli  1/16] FROM docker.io/library/debian:bookworm-20230612-slim@sha256:d8f9d38c21495b04d1cca99805fbb383856e19794265684019bf193c3b7d67f9
#5 resolve docker.io/library/debian:bookworm-20230612-slim@sha256:d8f9d38c21495b04d1cca99805fbb383856e19794265684019bf193c3b7d67f9 0.0s done
#5 DONE 0.0s

#5 [aws-cli  1/16] FROM docker.io/library/debian:bookworm-20230612-slim@sha256:d8f9d38c21495b04d1cca99805fbb383856e19794265684019bf193c3b7d67f9
#5 CACHED

#4 [internal] load build context
#4 transferring context: 113B done
#4 DONE 0.0s

#6 [aws-cli  3/16] RUN apt-get install -y --no-install-recommends ca-certificates=20230311
#6 CACHED

#7 [aws-cli  5/16] RUN apt-get install -y --no-install-recommends gnupg=2.2.40-1.1
#7 CACHED

#8 [aws-cli  8/16] RUN apt-get install -y --no-install-recommends jq=1.6-2.1
#8 CACHED

#9 [aws-cli 10/16] RUN curl --show-error --fail --output "awscliv2.zip" --remote-name "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.12.2.zip"
#9 CACHED

#10 [aws-cli  9/16] WORKDIR /workspace
#10 CACHED

#11 [aws-cli 11/16] COPY security/awscliv2.asc ./
#11 CACHED

#12 [aws-cli  7/16] RUN apt-get install -y --no-install-recommends git=1:2.39.2-1.1
#12 CACHED

#13 [aws-cli  4/16] RUN apt-get install -y --no-install-recommends curl=7.88.1-10
#13 CACHED

#14 [aws-cli  6/16] RUN apt-get install -y --no-install-recommends unzip=6.0-28
#14 CACHED

#15 [aws-cli 12/16] COPY security/awscli-exe-linux-x86_64-2.12.2.zip.sig ./awscliv2.sig
#15 ERROR: failed to calculate checksum of ref kzt9knyl0fyf2cf45s1s4vhek::r6u9iqhmmazdl2yv8u6qoi0hb: "/security/awscli-exe-linux-x86_64-2.12.2.zip.sig": not found

#16 [aws-cli  2/16] RUN apt-get update
#16 CANCELED

#17 [build 2/7] RUN apt-get update   && apt-get install -y --no-install-recommends     ca-certificates=20230311    git=1:2.39.2-1.1     jq=1.6-2.1     openssh-client=1:9.2p1-2   && apt-get clean   && rm -rf /var/lib/apt/lists/*
#17 CANCELED

#18 [terraform  2/14] RUN apt-get update
#18 CANCELED
------
 > [aws-cli 12/16] COPY security/awscli-exe-linux-x86_64-2.12.2.zip.sig ./awscliv2.sig:
------
Dockerfile:39
--------------------
  37 |     RUN curl --show-error --fail --output "awscliv2.zip" --remote-name "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip"
  38 |     COPY security/awscliv2.asc ./
  39 | >>> COPY security/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip.sig ./awscliv2.sig
  40 |     RUN gpg --import awscliv2.asc
  41 |     RUN gpg --verify awscliv2.sig awscliv2.zip
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref kzt9knyl0fyf2cf45s1s4vhek::r6u9iqhmmazdl2yv8u6qoi0hb: "/security/awscli-exe-linux-x86_64-2.12.2.zip.sig": not found
bgauduch commented 8 months ago

Hello @udoyen 👋

Thanks for you interest in this project and for opening this issue 🙏 Well I'm terribly sorry this issue went under radar 😓

This error happens when you try to build the image with an updated AWS version without it's related signature files. => The COPY operation fail because the file ‘security/awscli-exe-linux-x86_64-1.5.6.zip.sig‘ is not found in your local file system.

To correct this, you will need to locally download the required file as describe here : https://github.com/zenika-open-source/terraform-aws-cli/blob/master/docs/binaries-verifications.md#aws-cli-signature-and-pgp-verification

Be aware that you might have the same issue with the Terraform version later on 😉

ℹ️ I will try to make this documentation more reachable from the readme in the future !