Amazon S3 Cache plugin with AWS Credentials File

The drone-s3-cache plugin does not work with the aws credentials file or so it seems anyway.

The default expected behavior should be that the aws sdk (this case the aws sdk in go) should try to resolve aws credentials from ~/.aws/credentials. But I’m still getting access denied.

I have verified that it’s not a credentials issue because it works with drone-cache plugin. But I would rather use the drone-s3-cache plugin because it supports flushing cache.

I also tried setting the env variable HOME to /root so that aws will look in /root/.aws/ for the credentials file, but that didn’t work.

Here’s the drone config:

- name: restore_cache
  image: plugins/s3-cache
  settings:
    debug: true
    mount:
    - /root/.m2
    region: us-east-1
    restore: true
    root: my_s3_bucket
  environment:
    HOME: /root
  volumes:
  - name: aws_creds
    path: /root/.aws
  - name: m2
    path: /root/.m2
  depends_on:
  - get_aws_credentials

get_aws_credentials is the step that populates /root/.aws with the aws credentials file.

The debug option is also not showing anything that is useful.

the S3 plugin currently supports access keys (aws_access_key_id) and IAM and would need to be enhanced to support additional authentication mechanisms. This plugin is community maintained and I’m not sure if the maintainers monitor discourse for issues, so I would recommend creating an issue at https://github.com/drone-plugins/drone-s3-cache/issues

I checked the relevant code to verify how auth works and this is what I see:

1 Like

Here’s the issue if anyone’s interested: https://github.com/drone-plugins/drone-s3-cache/issues/62