忙しい人のためのまとめ
heroku-buildpack-rroongaの設定が変わってた
経緯
Tachikoma.io を使って Sebastian-badge.info を毎週 bundle update
しているのですが、2/21のビルドは問題なかったのに2/28のビルド以降Circle CIの自動デプロイに失敗するという事象がありました。
remote: -----> Fetching set buildpack https://github.com/groonga/heroku-buildpack-rroonga... done
remote: -----> Rroonga app detected
remote: -----> Initializing database
remote: bundle exec ruby groonga/init.rb
remote: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.5.0 in any of the sources (Bundler::GemNotFound)
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:85:in `map!'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:85:in `materialize'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/definition.rb:132:in `specs'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/definition.rb:177:in `specs_for'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/definition.rb:166:in `requested_specs'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/environment.rb:18:in `requested_specs'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:13:in `setup'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler.rb:122:in `setup'
remote: from /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.9.7/lib/bundler/setup.rb:18:in `<top (required)>'
remote: from /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
remote: from /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
remote:
remote: ! Push rejected, failed to compile Rroonga app
https://circleci.com/gh/sue445/sebastian-badge/269
bundle install
されてないだと・・・!?
いろいろ調べてたら2/23に入ってた heroku-buildpack-rroonga の変更が原因でした
https://github.com/groonga/heroku-buildpack-rroonga/commit/11af6d1bb0bf83210b7ca9129e171fd04c5b5158
対処法
Circle CIを使ってるので circle.ymlの修正を載せますが他のCIでもやることはだいたい同じだと思います
修正前
deployment:
production:
commands:
- heroku config:add BUILDPACK_URL="https://github.com/groonga/heroku-buildpack-rroonga" --app $HEROKU_APP_NAME
https://github.com/sue445/sebastian-badge/blob/aaf35ea8c02a99d57fbc18fe7ef49097258084d5/circle.yml#L37
修正後
READMEの通りにbuildpackを設定しなおしてやるだけ
deployment:
production:
commands:
- heroku buildpacks:add https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/groonga.tgz --app $HEROKU_APP_NAME || true
- heroku buildpacks:add heroku/ruby --app $HEROKU_APP_NAME || true
- heroku buildpacks:add https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/rroonga.tgz --app $HEROKU_APP_NAME || true
https://github.com/sue445/sebastian-badge/blob/040eb9a298ce06cf2648ccd1d8f2bdeea1ed6ccf/circle.yml#L37-L39
heroku buildpack:add 〜" の後に
|| trueをつけているのは、既にbuildpack追加済みの状態で
buildpacks:add` するとステータスコード1になりデプロイが途中で止まるのを回避するため。
heroku buildpacks:add https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/groonga.tgz --app $HEROKU_APP_NAME
▸ The buildpack
▸ https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/groonga.tgz
heroku buildpacks:add https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/groonga.tgz --app $HEROKU_APP_NAME returned exit code 1
▸ is already set on your app. Action failed: heroku buildpacks:add https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/groonga.tgz --app $HEROKU_APP_NAME
https://circleci.com/gh/sue445/sebastian-badge/271