環境
rails 5.0.7
ruby 2.5.1
devise
Circleci 2
エラー
circleciの設定をしておりますが、おそらくci時にdeviseの環境変数が読み込めずciでエラーが起きてしまいます。
.circleci/config.ymlで、どのように環境変数を読み込ませるのでしょうか?
#!/bin/bash -eo pipefail bin/rails db:schema:load --trace ** Invoke db:schema:load (first_time) ** Invoke environment (first_time) ** Execute environment DEPRECATION WARNING: #fog_provider is deprecated and has no effect (called from block in <top (required)> at /home/circleci/project/config/initializers/carrierwave.rb:7) rails aborted! Devise.secret_key was not set. Please add the following to your Devise initializer: config.secret_key = 'b0ccc
コード
config.yml
1version: 2 # use CircleCI 2.0 2jobs: # a collection of steps 3 build: # runs not using Workflows must have a `build` job as entry point 4 parallelism: 3 # run three instances of this job in parallel 5 docker: # run the steps with Docker 6 - image: circleci/ruby:2.5.1-node-browsers # ...with this image as the primary container; this is where all `steps` will run 7 environment: # environment variables for primary container 8 BUNDLE_JOBS: 3 9 BUNDLE_RETRY: 3 10 BUNDLE_PATH: vendor/bundle 11 PGHOST: 127.0.0.1 12 PGUSER: circleci-demo-ruby 13 RAILS_ENV: test 14 - image: circleci/mysql:5.7 15 environment: 16 MYSQL_ALLOW_EMPTY_PASSWORD: yes 17 MYSQL_ROOT_PASSWORD: '' 18 MYSQL_DATABASE: circleci 19 steps: # a collection of executable commands 20 - checkout # special step to check out source code to working directory 21 22 # Which version of bundler? 23 - run: 24 name: Which bundler? 25 command: bundle -v 26 27 # Restore bundle cache 28 # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ 29 - restore_cache: 30 keys: 31 - rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} 32 - rails-demo-bundle-v2- 33 34 - run: # Install Ruby dependencies 35 name: Bundle Install 36 command: bundle check --path vendor/bundle || bundle install --deployment 37 38 # Store bundle cache for Ruby dependencies 39 - save_cache: 40 key: rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} 41 paths: 42 - vendor/bundle 43 44 - run: 45 name: Yarn Install 46 command: yarn install --cache-folder ~/.cache/yarn 47 48 # Store yarn / webpacker cache 49 - save_cache: 50 key: rails-demo-yarn-{{ checksum "yarn.lock" }} 51 paths: 52 - ~/.cache/yarn 53 54 - run: 55 name: Wait for DB 56 command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s 57 58 - run: 59 name: Database setup 60 command: bin/rails db:schema:load --trace 61 62 - run: 63 name: Run rspec in parallel 64 command: | 65 bundle exec rspec --profile 10 \ 66 --format RspecJunitFormatter \ 67 --out test_results/rspec.xml \ 68 --format progress \ 69 $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) 70 71 # Save test results for timing analysis 72 - store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ 73 path: test_results 74 # See https://circleci.com/docs/2.0/deployment-integrations/ for example deploy configs 75
ruby
1Devise.setup do |config| 2 config.secret_key = ENV["DEVISE_SECRET_KEY"] 3以下略
CircleCiを触るのは初めてです。
もしわかるかたいらっしゃれば教えてください。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。