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

rails

#1

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?


Missing `secret_key_base` for 'test' environment, set this value in `config/secrets.yml`
Can't access env variables from my yml file
#2

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

Can't access env variables from my yml file
#3

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.


Could you tell me how to set Environment Variables?
#4

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

#5