Dynamically attach secret file

I am configuring .drone.yml file in my Rails Project. The app is dockerized and uses Rails 5. I am having issues running tests on Drone Server. I think the cause of issue is that I am unable to attach secrets from Rails Sample Credentials file to Drone.

I did see that you can add secrets manually and then use from_secrets. But I want my whole rails.credentials.sample file to be available in secrets.

  1. store the contents of your credentials file as a secret
  2. source an environment variable from secret in your yaml
environment:
  MY_CREDENTIALS:
    from_secret: credentials_file
  1. write the environment variable to a file
environment:
  MY_CREDENTIALS:
    from_secret: credentials_file
commands:
- echo "$MY_CREDENTIALS" > credentials.yml.enc
2 Likes