現在Dockerでrailsアプリを作成して、CircleCIの導入をおこなっております。
まだ簡単な表示(Hello World)しか実装していませんが、
CircleCIで自動ビルド&テストの動作確認を行おうとしたところ、
「bundle exec rails db:migrate」実行時に下記エラーが発生して詰まりました。
まだBundlerについての理解(Gemの保存先など)が乏しいため、
いろいろ調べましたが解決策が見つからず、どこに原因があるのかも見当がつきませんので
ご教授いただければと思います。
発生している問題・エラーメッセージ
エラーメッセージ Could not find rake-13.0.6 in any of the sources Run `bundle install` to install missing gems.
.circleci/config.yml
version: 2.1 orbs: ruby: circleci/ruby@1.1.2 jobs: build: docker: - image: circleci/ruby:2.7.5 working_directory: ~/app/src steps: - checkout: path: ~/app - ruby/install-deps test: docker: - image: circleci/ruby:2.7.5 - image: circleci/postgres:13.5 environment: POSTGRES_USER: postgres POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_DB: app_test environment: BUNDLE_JOBS: "3" BUNDLE_RETRY: "3" APP_DATABASE_HOST: "127.0.0.1" RAILS_ENV: test working_directory: ~/app/src steps: - checkout: path: ~/app - ruby/install-deps - run: name: Database setup command: bundle exec rails db:migrate - run: name: test command: bundle exec rake test workflows: version: 2 build_and_test: jobs: - build - test: requires: - build
試したこと
Docker開発環境でのマイグレーション実行
$ docker-compose exec web bundle exec rails db:migrate Running via Spring preloader in process 408
###気になった点
ローカルでCircleCIを実行したところ、下記動作をおこなっているようでした。(rake 13.0.6をインストールしている?)
ですがクラウド上のログでは、「Gemfileの依存関係が満たされている」とのことでgemインストールしていない気がします。
ただ、どちらも失敗するので関係あるかはわかりません。
ローカルのBundle Installログ(一部抜粋)
$ circleci local execute : 省略 Gemfile.lock is bundled with bundler version 2.1.4 bundler 2.1.4 is already installed. [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path './vendor/bundle'`, and stop using this flag The following gems are missing * rake (13.0.6) * concurrent-ruby (1.1.9) : 省略 Install missing gems with `bundle install` [DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag Fetching gem metadata from https://rubygems.org/.......... Fetching rake 13.0.6 Installing rake 13.0.6 Fetching concurrent-ruby 1.1.9 Installing concurrent-ruby 1.1.9 Fetching i18n 1.8.11
補足情報(関連しそうなソースコード)
Gemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.7.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.4', '>= 6.1.4.4' # Use postgresql as the database for Active Record gem 'pg', '~> 1.1' # Use Puma as the app server gem 'puma', '~> 5.0' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.4', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 4.1.0' # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md gem 'rack-mini-profiler', '~> 2.0' gem 'listen', '~> 3.3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 3.26' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data'
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。