drone-plugins / drone-s3

Drone plugin for publishing artifacts to Amazon S3
http://plugins.drone.io/drone-plugins/drone-s3
Apache License 2.0
37 stars 65 forks source link

Support setting ContentType and ContentEncoding #54

Closed fernandrone closed 4 years ago

fernandrone commented 6 years ago

Hey,

Currently this plugin does not support setting ContentType and ContentEnconding. At QuintoAndar we use this plugin to upload files to S3 which are then served to different web pages so this is necessary (and should be a pretty common use-case), and is one of the reasons I keep a fork here: https://github.com/quintoandar/drone-s3.

Drone S3 Sync currently supports them.

I have a Pull Request on the way but would like to consider a few points first.

  1. drone-s3-sync uses glob matching, but in my original fork I went for a regex matcher. This allows us to set metadata like this:
    content_type:
      ".*(css|cgz)$": "text/css"
      ".*(ttf|woff|woff2)$": "application/octet-stream"

I'm fine either way but would like to know if there's more interest in using regex over glob.

  1. Have you ever considered merging drone-s3 and drone-s3-sync plugins? A lot of the code is pretty similar, so this means half the maintenance costs. The sync could be a parameter sync: true that is false by default.
fernandrone commented 6 years ago

Worth noting, there was a PR here from a coworker (https://github.com/drone-plugins/drone-s3/pull/34) that added content_type support which @tboerger reviewed but never got merged.

tboerger commented 4 years ago

I have taken more or less the code of the plugin fork within https://github.com/drone-plugins/drone-s3/pull/63 to get this finally integrated.