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

Support different bucket name conventions #33

Closed jbrockopp closed 6 years ago

jbrockopp commented 6 years ago

We have a use-case where an end-user has an org on GitHub that has less than 3 characters.

From Amazon:

Bucket names must be at least 3 and no more than 63 characters long

Now I'll admit that it took us over 2 years to run into this issue so I understand the initial grimace at implementing this. However, since it is allowed by VC systems (like GitHub and GitLab), I believe an argument could be made that it's a bug since it's functionality supported by the VCS but breaks because of the plugin.

jbrockopp commented 6 years ago

We came up with a few initial ideas and we wondering if one was more favorable than the other:

  1. Make the plugin by default append drone- before every bucket name
    • This would be the easiest implementation
    • Would prevent end-users from having an org name that is > 57 characters
  2. Serialize the org name (base64, md5, sha)
    • Guarantee to not have bucket name conflicts
    • Mapping buckets to orgs becomes more challenging
    • A scheme like base64 would prevent end-users from having an org name that is > 45 characters
  3. Allow the end-user to override the bucket name
    • Easy to implement
    • Could cause bucket name conflicts if a end-user chooses a bucket name that is the same as another org name
  4. Allow the end-user to append a prefix/suffix
    • Easy to implement
    • Could cause bucket name conflicts if a end-user appends a prefix/suffix to their org that causes their bucket name to be the same as another org name

Thoughts on the above?

tboerger commented 6 years ago

You can already customize all paths via attributes, to be more specific you can overwrite root and also path. They are also more or less documented at http://plugins.drone.io/drone-plugins/drone-s3-cache/#parameter-reference.

The element you want to change should be specifically root to change the used bucket, for reference:

So IMHO we don't need to change anything on this plugin itself, maybe we should simply provide an example on the documentation that explains the behavior of root and path properly.

jbrockopp commented 6 years ago

@tboerger I didn't even know that was possible. I think just adding some example docs would be plenty sufficient then!

tboerger commented 6 years ago

Maybe you want to create an pull request to the plugin index? :)

Or raise an issue over there...

jbrockopp commented 6 years ago

Sure I'll do so. Thanks again! 👍