以前書いた記事werckerでのエラーを解決した時の備忘録【その1】の第二弾となります。
werckerのビルド、デプロイ時に起こったエラーの解決をした際の備忘録を残しておきます。
wercker側で出たエラーは日本語のドキュメントが少なく、エラーの原因特定をすることがとても難しいです。
同じエラーで悩んでいる方がいればこの記事が少しでも参考になればと思います。
■werckerデプロイ時にUpdate databaseで起こったエラー
・デプロイ時に出たエラーは下記となります。
cd $WERCKER_SOURCE_DIR
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /pipeline/build/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
ruby-2.1.5 is not installed.
To install do: 'rvm install ruby-2.1.5'
$ export WERCKER_STEP_ROOT="/wercker/steps/wercker/rvm-use/1.0.0"
$ export WERCKER_STEP_ID="cdc7dc67-561d-4ae3-86ea-ee3f7367fc98"
$ export WERCKER_STEP_NAME="rvm-use"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ export WERCKER_RVM_USE_VERSION="2.1.5"
$ export WERCKER_RVM_USE_CREATE="false"
$ source "$WERCKER_STEP_ROOT/run.sh"
RVM is installed: rvm 1.26.11 (latest) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
Installed Rubies:
rvm rubies
ruby-2.0.0-p645 [ x86_64 ]
ruby-2.0.0-p647 [ x86_64 ]
ruby-2.0.0-p648 [ x86_64 ]
ruby-2.1.6 [ x86_64 ]
ruby-2.1.7 [ x86_64 ]
ruby-2.1.8 [ x86_64 ]
ruby-2.2.2 [ x86_64 ]
ruby-2.2.3 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]
=* ruby-2.3.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Going to use Ruby version 2.1.5
rvm use 2.1.5
ruby-2.1.5 is not installed.
To install do: 'rvm install ruby-2.1.5'
◎解決方法
上記ビルドエラーの原因はwercker/box-rvmのバージョンが上がっており、
そのバージョンではruby2.1.5が削除されていて使えないことにありました。
GitHubのwercker/box-rvmの「Changelog」を確認すると5.0.0になった時点で「Removed ruby-2.1.5」となっていました。
Removed ruby-2.1.5されていない4.0.0をwercker.ymlにwercker/box-rvmのバージョン指定を行うことで解決しました。
■エラーが出ていた時のwercker.ymlのdeploy部分の記述
box: wercker
■エラー解決した際のwercker.ymlのdeploy部分の記述
box: wercker/rvm@4.0.0
下記サイトがとても参考になりました。
・WerckerのRVM boxで削除されたバージョンのRubyを使いたい時
http://qiita.com/mktakuya/items/d56e8a1c576ca9ee253c