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
29 stars 30 forks source link

Doesn't accept s3:// URLs #45

Closed jpds closed 3 years ago

jpds commented 5 years ago

I was surprised to discover that this plugin doesn't support the standard s3:// URL format for S3 buckets.

tboerger commented 5 years ago

Why do you want to define that at all?

jpds commented 5 years ago

Because it isn't at all clear from the documentation how else it's used (given everything else is minio examples).

tboerger commented 5 years ago

And the description of the endpoint parameter within the docs isn't clear enough?

custom endpoint URL (optional, to use a S3 compatible non-Amazon service)

jpds commented 5 years ago

And the description of the endpoint parameter within the docs isn't clear enough?

Nope, how do I configure the bucket that the cache goes into? Why is there a s3_endpoint variable? Does it behave in the same way the endpoint variable does? Why does Drone do something that none of the other tools that use S3 URLs do? awscli, s3cmd, gitlab-runner1?

techknowlogick commented 5 years ago

The path configuration option:

path to store the cache file, defaults to [root]/<owner>/<repo>/<branch>/ (optional)

Edit: this plugin behaviour matches the other drone cache plugins

tboerger commented 5 years ago

The endpoint variables are only required if you want to use another service than S3, that's the case for all Drone plugins and also only required for other tools like s3cmd and so on. So Drone is not doing anything special!

And IMHO http://plugins.drone.io/drone-plugins/drone-s3-cache/ pretty clearly states that the endpoint attribute is OPTIONAL, only required for S3 compatible non-Amazon services.

Please read about Drone secrets, than you should get why there is s3_endpoint beside an inline endpoint attribute.

The only thing that is not clearly stated is something that mentions the bucket is by default defined by the org name and that it can be optionally customized by the root attribute. Instead of complaining that it doesn't work you should consider asking on the forum, Reddit or StackOverflow a maintainer or author how they expect to work with it. Then we can start a constructive discussion about how to make it better accessible.

jpds commented 5 years ago

The endpoint variables are only required if you want to use another service than S3, that's the case for all Drone plugins and also only required for other tools like s3cmd and so on. So Drone is not doing anything special!

What I mean about other tools is that they support URLs like s3://bucket-name/ which this drone plugin doesn't support.

And IMHO http://plugins.drone.io/drone-plugins/drone-s3-cache/ pretty clearly states that the endpoint attribute is OPTIONAL, only required for S3 compatible non-Amazon services.

Sure, then provide YAML snippets for for working S3 examples rather than just minio to make the documentation clearer.

Please read about Drone secrets, than you should get why there is s3_endpoint beside an inline endpoint attribute.

I know about Drone secrets and use them on my server. Does the s3_endpoint work with s3:// URLs in a similar fashion?

vovimayhem commented 5 years ago

Oh my! I was banging my head on how to configure the bucket name. So root would be?

Pajk commented 5 years ago

FYI to use a non-default S3 region you have to set also the region to make it work. You can find it in the AWS docs.

laszlocph commented 5 years ago

Oh my! I was banging my head on how to configure the bucket name. So root would be?

yep, didn't find it intuitive either. Here is a snippet that worked for me:

kind: pipeline
name: default

steps:
- name: restore
  image: plugins/s3-cache
  settings:
    pull: true
    root: cachetest1.laszlo.cloud
    # region: "us-east-1"
    access_key:
      from_secret: aws_access_key_id
    secret_key:
      from_secret: aws_secret_access_key
    restore: true

Wrote a blogpost about this and other cache solutions: https://laszlo.cloud/the-ultimate-droneci-caching-guide#distribute-caching-with-buckets

tsloughter commented 5 years ago

I too am here because I found the docs confusing. If they simply said root is the bucket name if using s3 I don't think there would be much confusion.

donny-dont commented 3 years ago

Fixed in https://github.com/drone-plugins/drone-s3-cache/pull/59