diff --git a/.gitlab/ci/dev-fixtures.gitlab-ci.yml b/.gitlab/ci/dev-fixtures.gitlab-ci.yml index f89456a18fb98c871c124eb27e05ee9b0f0634e4..891a5dd79ad17a836a47cfde01c24016e764913b 100644 --- a/.gitlab/ci/dev-fixtures.gitlab-ci.yml +++ b/.gitlab/ci/dev-fixtures.gitlab-ci.yml @@ -15,8 +15,8 @@ # SEED_NESTED_GROUPS: "false" # requires network connection .run-dev-fixtures-script: &run-dev-fixtures-script - - run_timed_command "scripts/gitaly-test-spawn" - - run_timed_command "bundle exec rake db:seed_fu" + - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn"; # Do not use 'bundle exec' here + - section_start "seeding-db" "Seeding DB"; bundle exec rake db:seed_fu; section_end "seeding-db"; run-dev-fixtures: extends: diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index 4d28bc772b77b67a9000b6dd9510ee2a59da6b17..be983b177b284d1ef7439161b2c66b19a19bde19 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -138,7 +138,6 @@ retrieve-frontend-fixtures: # More information in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74003. WEBPACK_VENDOR_DLL: "true" script: - - source scripts/utils.sh - source scripts/gitlab_component_helpers.sh - | if [[ -d "tmp/tests/frontend" ]]; then @@ -153,7 +152,7 @@ retrieve-frontend-fixtures: echo "No frontend fixtures directory, generating frontend fixtures." fi - run_timed_command "gem install knapsack --no-document" - - run_timed_command "scripts/gitaly-test-spawn" + - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn"; # Do not use 'bundle exec' here - source ./scripts/rspec_helpers.sh - rspec_paralellized_job artifacts: diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 6e055d5b3ec8cdfa0025e14d6fb4c6a13cb5539d..2c31a6f6775d2a4fc5ae17c4c82d3fe40fad9e75 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -15,11 +15,9 @@ setup-test-env: - echo $CI_MERGE_REQUEST_APPROVED - source scripts/gitlab_component_helpers.sh - run_timed_command "download_and_extract_gitlab_workhorse_package" || true - - run_timed_command "scripts/setup-test-env" - - run_timed_command "select_gitlab_workhorse_essentials" - - echo -e "\e[0Ksection_start:`date +%s`:gitaly-test-build[collapsed=true]\r\e[0KCompiling Gitaly binaries" - - run_timed_command "scripts/gitaly-test-build" # Do not use 'bundle exec' here - - echo -e "\e[0Ksection_end:`date +%s`:gitaly-test-build\r\e[0K" + - section_start "setup-test-env" "Setting up testing environment"; scripts/setup-test-env; section_end "setup-test-env"; + - select_gitlab_workhorse_essentials + - section_start "gitaly-test-build" "Compiling Gitaly binaries"; scripts/gitaly-test-build; section_end "gitaly-test-build"; # Do not use 'bundle exec' here artifacts: expire_in: 7d paths: diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml index adcfcd2010f360759fa2e315980ecbe590923a2c..33aef166afdbdfaf411eae378ba0d04b2f4060b4 100644 --- a/.gitlab/ci/rails/shared.gitlab-ci.yml +++ b/.gitlab/ci/rails/shared.gitlab-ci.yml @@ -25,7 +25,7 @@ include: # gems could not be found under some circumstance. No idea why, hours wasted. - run_timed_command "gem install knapsack --no-document" - echo -e "\e[0Ksection_start:`date +%s`:gitaly-test-spawn[collapsed=true]\r\e[0KStarting Gitaly" - - run_timed_command "scripts/gitaly-test-spawn" # Do not use 'bundle exec' here + - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn" # Do not use 'bundle exec' here - echo -e "\e[0Ksection_end:`date +%s`:gitaly-test-spawn\r\e[0K" .single-db: diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index 0b5860b3ddb5ee8e9c917373c0ea3c8866e2c5f8..f2d9bbc6ffa71fb1495fd84b6f9f9d16e06ac748 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -90,7 +90,7 @@ generate-frontend-fixtures-mapping: before_script: - !reference [.default-before_script, before_script] - source ./scripts/rspec_helpers.sh - - run_timed_command "scripts/gitaly-test-spawn" + - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn"; # Do not use 'bundle exec' here script: - generate_frontend_fixtures_mapping artifacts: diff --git a/scripts/utils.sh b/scripts/utils.sh index 80057842c28605aa8313de1db6f0db9b3a984499..b41bc18deffb37e7838f2527ecf66f717297dac1 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -63,6 +63,19 @@ function test_url() { fi } +function section_start () { + local section_title="${1}" + local section_description="${2:-$section_title}" + + echo -e "section_start:`date +%s`:${section_title}[collapsed=true]\r\e[0K${section_description}" +} + +function section_end () { + local section_title="${1}" + + echo -e "section_end:`date +%s`:${section_title}\r\e[0K" +} + function bundle_install_script() { local extra_install_args="${1}" @@ -72,7 +85,7 @@ function bundle_install_script() { exit 1; fi; - echo -e "section_start:`date +%s`:bundle-install[collapsed=true]\r\e[0KInstalling gems" + section_start "bundle-install" "Installing gems" gem --version bundle --version @@ -93,23 +106,23 @@ function bundle_install_script() { run_timed_command "bundle pristine pg" fi - echo -e "section_end:`date +%s`:bundle-install\r\e[0K" + section_end "bundle-install" } function yarn_install_script() { - echo -e "section_start:`date +%s`:yarn-install[collapsed=true]\r\e[0KInstalling Yarn packages" + section_start "yarn-install" "Installing Yarn packages" retry yarn install --frozen-lockfile - echo -e "section_end:`date +%s`:yarn-install\r\e[0K" + section_end "yarn-install" } function assets_compile_script() { - echo -e "section_start:`date +%s`:assets-compile[collapsed=true]\r\e[0KCompiling frontend assets" + section_start "assets-compile" "Compiling frontend assets" bin/rake gitlab:assets:compile - echo -e "section_end:`date +%s`:assets-compile\r\e[0K" + section_end "assets-compile" } function setup_db_user_only() { @@ -121,9 +134,13 @@ function setup_db_praefect() { } function setup_db() { - run_timed_command "setup_db_user_only" + section_start "setup-db" "Setting up DBs" + + setup_db_user_only run_timed_command_with_metric "bundle exec rake db:drop db:create db:schema:load db:migrate gitlab:db:lock_writes" "setup_db" - run_timed_command "setup_db_praefect" + setup_db_praefect + + section_end "setup-db" } function install_gitlab_gem() { @@ -136,7 +153,7 @@ function install_tff_gem() { } function install_activesupport_gem() { - run_timed_command "gem install activesupport --no-document --version 6.1.7.1" + run_timed_command "gem install activesupport --no-document --version 6.1.7.2" } function install_junit_merge_gem() {