add bundler version check to docker_dev_update

we've seen some issues with bundler version getting out of sync
on containers leading to the bundle_install_with_check failing.
Add a bundler version check to the bundle_install_with_check to
install the correct version if needed.

flag = none
closes: DE-592

Test Plan:
-running docker_dev_update passes, no noticable changes
-update bundler gem to the latest inside web container
  -run docker_dev_update
  -message stating wrong version of bundler found
  -installs correct version and completes without error
-update bundler to latest inside web container, remove a gem
  -run docker_dev_update
  -message stating wrong version of bundler found
  -installs correct version and installs missing gem

Change-Id: I485c36924ba0e6e7f908abd165987d3f75900b63
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261969
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
This commit is contained in:
James Butters 2021-03-31 09:15:12 -06:00
parent 7bf1651a45
commit 8464842a3f
1 changed files with 10 additions and 1 deletions

View File

@ -96,15 +96,24 @@ If you want to migrate the existing database, use docker_dev_update
bundle exec rake db:initial_setup
}
function sync_bundler_version {
expected_version=$(run_command bash -c "echo \$BUNDLER_VERSION")
actual_version=$(eval run_command bundler --version |grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")
if [[ "$actual_version" != "$expected_version" ]]; then
echo_console_and_log " Wrong version of bundler installed, installing correct version..."
run_command bash -c "gem uninstall --all --ignore-dependencies --force bundler && gem install bundler --no-document -v $expected_version" >>"$LOG" 2>&1
fi
}
function bundle_install {
echo_console_and_log " Installing gems (bundle install) ..."
rm -f Gemfile.lock* >/dev/null 2>&1
run_command bash -c 'rm -f Gemfile.lock* >/dev/null 2>&1'
_canvas_lms_track_with_log run_command bundle install
}
function bundle_install_with_check {
echo_console_and_log " Checking your gems (bundle check) ..."
sync_bundler_version
if _canvas_lms_track_with_log run_command bundle check ; then
echo_console_and_log " Gems are up to date, no need to bundle install ..."
else