drone-plugins / drone-s3-cache

Caches build artifacts to S3 compatible storage backends
http://plugins.drone.io/drone-plugins/drone-s3-cache
Apache License 2.0
28 stars 30 forks source link

Failing to connect when using AWS EC2 meta endpoint for credentials #74

Open jtallinger opened 1 year ago

jtallinger commented 1 year ago

Hello,

I have been using following in my drone.yml which has worked great for quite some time (~2 years)

  - name: cache-rebuild
    image: plugins/s3-cache
    settings:
      pull: true
      endpoint: https://s3.eu-central-1.amazonaws.com
      rebuild: true
      mount:
        - vendor
      root: /abc-private-prod/build-cache/

But for past recent days it have started to fail with following error:

latest: Pulling from plugins/s3-cache Digest: sha256:e92acfb16ac670f57dfe5831a8ca42d12080e6c6f4b9d9e419a8f4a2d093901c Status: Downloaded newer image for plugins/s3-cache:latest time="2022-12-14T10:52:00Z" level=info msg="mode specified using boolean config" flush=false rebuild=false restore=true time="2022-12-14T10:52:00Z" level=info msg="using mode" mode=restore time="2022-12-14T10:52:00Z" level=info msg="region found in S3 endpoint" region=eu-central-1 time="2022-12-14T10:52:00Z" level=info msg="using S3 endpoint" endpoint=s3.amazonaws.com use-ssl=true time="2022-12-14T10:52:01Z" level=error msg="execution failed: could not connect to s3.amazonaws.com using IAM role: Put \"http://169.254.169.254/latest/api/token\": context deadline exceeded"

Credentials are pulled from the AWS EC2 meta data endpoint. If I switch to older image plugins/s3-cache:1.4 then it works fine.

When using tag 1.4:

1.4: Pulling from plugins/s3-cache Digest: sha256:c695d58362451cd79fc9673bdfbfa71ef033cc76165b53db49b015750997b9d0 Status: Downloaded newer image for plugins/s3-cache:1.4 time="2022-12-14T11:26:35Z" level=info msg="No path specified. Creating default" time="2022-12-14T11:26:35Z" level=info msg="No fallback_path specified. Creating default" time="2022-12-14T11:26:35Z" level=info msg="No flush_path specified. Creating default" time="2022-12-14T11:26:35Z" level=info msg="No filename specified. Creating default" time="2022-12-14T11:26:35Z" level=info msg="Restoring cache at /abc-private-prod/build-cache/abc/master/archive.tar" time="2022-12-14T11:26:35Z" level=info msg="Retrieving file in abc-private-prod at build-cache/abc/master/archive.tar" time="2022-12-14T11:26:35Z" level=info msg="Copying object from the server" time="2022-12-14T11:26:38Z" level=info msg="Downloaded 108 MB from server" time="2022-12-14T11:26:38Z" level=info msg="Cache restored"