improve logging/output for docker_dev_update.sh

Align the UX of docker_dev_update to the one we implemented
on the setup script. Use the spinner where the commands take
longer to be executed.

refs DE-625
flag = none

test-plan:
- Local docker dev smoke passes
- docker_dev_update works locally

Change-Id: I94b1eca298b3f398dfb88dff1ceedeb66d5a6c22
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263186
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
This commit is contained in:
Andrea Cirulli 2021-04-19 15:37:11 -05:00
parent abedde2b37
commit 321e89c88d
2 changed files with 20 additions and 8 deletions

View File

@ -15,8 +15,9 @@ function is_canvas_root {
}
function compile_assets {
echo_console_and_log " Compiling assets (css and js only, no docs or styleguide) ..."
start_spinner "Compiling assets (css and js only, no docs or styleguide)..."
_canvas_lms_track_with_log run_command bundle exec rake canvas:compile_assets_dev
stop_spinner
}
function build_images {
@ -112,41 +113,51 @@ If you want to migrate the existing database, use docker_dev_update
}
function sync_bundler_version {
start_spinner "Checking bundler version..."
expected_version=$(run_command bash -c "echo \$BUNDLER_VERSION" |grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")
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..."
stop_spinner
start_spinner " Wrong version of bundler installed, installing correct version..."
_canvas_lms_track_with_log run_command bash -c "gem uninstall --all --ignore-dependencies --force --executables bundler"
_canvas_lms_track_with_log run_command bash -c "gem install bundler --no-document -v $expected_version"
stop_spinner
fi
stop_spinner
}
function bundle_install {
echo_console_and_log " Installing gems (bundle install) ..."
start_spinner " Installing gems (bundle install) ..."
run_command bash -c 'rm -f Gemfile.lock* >/dev/null 2>&1'
_canvas_lms_track_with_log run_command bundle install
stop_spinner
}
function bundle_install_with_check {
echo_console_and_log " Checking your gems (bundle check) ..."
sync_bundler_version
start_spinner "Checking your gems (bundle check)..."
if _canvas_lms_track_with_log run_command bundle check ; then
stop_spinner
echo_console_and_log " Gems are up to date, no need to bundle install ..."
else
stop_spinner
bundle_install
fi
}
function rake_db_migrate_dev_and_test {
echo_console_and_log " Migrating development DB ..."
start_spinner "Migrating development DB..."
_canvas_lms_track_with_log run_command bundle exec rake db:migrate RAILS_ENV=development
echo_console_and_log " Migrating test DB ..."
stop_spinner
start_spinner "Migrating test DB..."
_canvas_lms_track_with_log run_command bundle exec rake db:migrate RAILS_ENV=test
stop_spinner
}
function install_node_packages {
echo_console_and_log " Installing Node packages ..."
start_spinner "Installing Node packages..."
_canvas_lms_track_with_log run_command bundle exec rake js:yarn_install
stop_spinner
}
function copy_docker_config {

View File

@ -109,8 +109,9 @@ function confirm_command {
}
function docker_compose_up {
message "Starting docker containers..."
start_spinner "Starting docker containers..."
_canvas_lms_track_with_log docker-compose up -d web
stop_spinner
}
function check_dependencies {