How can I set secrets.yml for test environment for CircleCI?

I’m using Rspec with Ruby 2.2.2 and Rails 4.2. My tests pass on my local system. But these fail on CircleCI with error:
ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key

My secrets.yml is not on git. How can I set secrets.yml for test environment for CircleCI?

1 Like

This solution worked out for me:

  1. Create config/secrets.ci.yml with test environment variables.
  2. Add circle.yml to the root directory:

circle.yml

machine:
  ruby:
    version:
      2.2.2

dependencies:
  override:
    - mv config/secrets.ci.yml config/secrets.yml
1 Like

Another option could be using CircleCI Environment Variables. This would allow you to load in secret info without it being in your repository or file system at all.

Not to mention that the AWS CLI will automatically read those variables from the environment if they are present.

1 Like

I have my secrets on an Amazon bucket, and I use the AWS credentials from circleCI to download it before the test starts

test:
  pre:
    - >
      aws s3 cp
      s3://my-config-bucket/test/rails/secrets.yml ~/MyApp/config/
      --region eu-central-1