diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-14 18:08:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-14 18:08:14 +0300 |
commit | 87f286558de1f5790b0b1742f10548387b5d147a (patch) | |
tree | c483d5f3542094d2123c8116ffee22430d9ad9c9 /scripts | |
parent | 674e7e2c3d295704bdf504dd0caa2e5a2d9b5cd2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gitaly_test.rb | 2 | ||||
-rw-r--r-- | scripts/prepare_build.sh | 9 | ||||
-rw-r--r-- | scripts/utils.sh | 35 |
3 files changed, 38 insertions, 8 deletions
diff --git a/scripts/gitaly_test.rb b/scripts/gitaly_test.rb index 8db47afdd4d..e6f2c9885d9 100644 --- a/scripts/gitaly_test.rb +++ b/scripts/gitaly_test.rb @@ -20,7 +20,7 @@ module GitalyTest 'HOME' => File.expand_path('tmp/tests'), 'GEM_PATH' => Gem.path.join(':'), 'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), - 'BUNDLE_FLAGS' => "--jobs=4 --retry=3", + 'BUNDLE_FLAGS' => "--jobs=4 --retry=3 --quiet", 'BUNDLE_INSTALL_FLAGS' => nil, 'BUNDLE_GEMFILE' => gemfile, 'RUBYOPT' => nil, diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 7bf3f887e97..d2cc16f4f8b 100644 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -6,12 +6,17 @@ export BUNDLE_INSTALL_FLAGS="--without=production --jobs=$(nproc) --path=vendor if [ "$USE_BUNDLE_INSTALL" != "false" ]; then bundle --version - bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check + run_timed_command "bundle install --clean ${BUNDLE_INSTALL_FLAGS}" + run_timed_command "bundle check" + # When we test multiple versions of PG in the same pipeline, we have a single `setup-test-env` + # job but the `pg` gem needs to be rebuilt since it includes extensions (https://guides.rubygems.org/gems-with-extensions). + # Uncomment the following line if multiple versions of PG are tested in the same pipeline. + # run_timed_command "bundle pristine pg" fi # Only install knapsack after bundle install! Otherwise oddly some native # gems could not be found under some circumstance. No idea why, hours wasted. -retry gem install knapsack --no-document +run_timed_command "gem install knapsack --no-document" cp config/gitlab.yml.example config/gitlab.yml sed -i 's/bin_path: \/usr\/bin\/git/bin_path: \/usr\/local\/bin\/git/' config/gitlab.yml diff --git a/scripts/utils.sh b/scripts/utils.sh index d1f98bb3f62..897f8d5a8b8 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -18,11 +18,8 @@ function setup_db_user_only() { } function setup_db() { - setup_db_user_only - - bundle exec rake db:drop db:create db:structure:load db:migrate - - bundle exec rake gitlab:db:setup_ee + run_timed_command "setup_db_user_only" + run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee" } function install_api_client_dependencies_with_apk() { @@ -38,6 +35,24 @@ function install_gitlab_gem() { gem install gitlab --no-document --version 4.13.0 } +function run_timed_command() { + local cmd="${1}" + local start=$(date +%s) + echosuccess "\$ ${cmd}" + eval "${cmd}" + local ret=$? + local end=$(date +%s) + local runtime=$((end-start)) + + if [[ $ret -eq 0 ]]; then + echosuccess "==> '${cmd}' succeeded in ${runtime} seconds." + return 0 + else + echoerr "==> '${cmd}' failed (${ret}) in ${runtime} seconds." + return $ret + fi +} + function echoerr() { local header="${2}" @@ -58,6 +73,16 @@ function echoinfo() { fi } +function echosuccess() { + local header="${2}" + + if [ -n "${header}" ]; then + printf "\n\033[0;32m** %s **\n\033[0m" "${1}" >&2; + else + printf "\033[0;32m%s\n\033[0m" "${1}" >&2; + fi +} + function get_job_id() { local job_name="${1}" local query_string="${2:+&${2}}" |