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

Feature: Allow user to load environment variables from file. #133

Open SeJunB opened 1 year ago

SeJunB commented 1 year ago

This PR allows the user to load environment variables from env-file. In particular, the environment variables loaded from env-file will overwrite any existing environment variables, since one of the primary use for this feature will be to override the plugin variables (PLUGIN_*) that is injected by drone.

Example: Dynamically set target to testReport_XXXX, where XXXX is the current date and time.

...

- name: create env
  image: alpine
  commands:
    - echo PLUGIN_TARGET=/testReport_$$(date +"%Y-%m-%dT%H.%m.%S")UTC > target-env

- name: upload
  image: plugins/s3
  settings:
    bucket: BUCKET_NAME
    region: us-east-1
    source: results/**/*
    env-file: ./target-env
  depends_on:
    - create env

132