Commit 4d332efb authored by Rémy Coutable's avatar Rémy Coutable

Dogfood YAML anchors in CI config

This allows to DRY up the config a bit.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 36e252d1
......@@ -14,14 +14,17 @@
SIZE: 0 # number of external projects to fork, requires network connection
# SEED_NESTED_GROUPS: "false" # requires network connection
.run-dev-fixtures-script: &run-dev-fixtures-script
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- run_timed_command "RAILS_ENV=test bundle exec rake db:seed_fu"
run-dev-fixtures:
extends:
- .run-dev-fixtures
- .dev-fixtures:rules:ee-and-foss
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- run_timed_command "RAILS_ENV=test bundle exec rake db:seed_fu"
- *run-dev-fixtures-script
run-dev-fixtures-ee:
extends:
......@@ -29,7 +32,5 @@ run-dev-fixtures-ee:
- .dev-fixtures:rules:ee-only
- .use-pg11-ee
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- cp ee/db/fixtures/development/* $FIXTURE_PATH
- run_timed_command "RAILS_ENV=test bundle exec rake db:seed_fu"
- *run-dev-fixtures-script
......@@ -7,6 +7,10 @@
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
.yarn-install: &yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
.compile-assets-base:
extends:
- .frontend-base
......@@ -16,9 +20,7 @@
WEBPACK_VENDOR_DLL: "true"
stage: prepare
script:
- node --version
- run_timed_command "retry yarn install --frozen-lockfile"
- free -m
- *yarn-install
- run_timed_command "bin/rake gitlab:assets:compile"
- run_timed_command "scripts/clean-old-cached-assets"
......@@ -85,8 +87,7 @@ update-yarn-cache:
- .shared:rules:update-cache
stage: prepare
script:
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
cache:
policy: push
......@@ -137,14 +138,14 @@ eslint-as-if-foss:
- .as-if-foss
needs: []
script:
- run_timed_command "retry yarn install --frozen-lockfile"
- yarn run eslint
- *yarn-install
- run_timed_command "yarn run eslint"
.karma-base:
extends: .frontend-test-base
script:
- export BABEL_ENV=coverage CHROME_LOG_FILE=chrome_debug.log
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
- run_timed_command "yarn karma"
karma:
......@@ -175,7 +176,7 @@ karma-as-if-foss:
.jest-base:
extends: .frontend-test-base
script:
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
- run_timed_command "yarn jest --ci --coverage --testSequencer ./scripts/frontend/parallel_ci_sequencer.js"
jest:
......@@ -200,7 +201,7 @@ jest-integration:
- .frontend-test-base
- .frontend:rules:default-frontend-jobs
script:
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
- run_timed_command "yarn jest:integration --ci"
needs: ["frontend-fixtures"]
......@@ -220,8 +221,7 @@ coverage-frontend:
needs: ["jest"]
stage: post-test
before_script:
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
script:
- run_timed_command "yarn node scripts/frontend/merge_coverage_frontend.js"
coverage: '/^Statements\s*:\s*?(\d+(?:\.\d+)?)%/'
......@@ -241,9 +241,8 @@ coverage-frontend:
stage: test
dependencies: []
script:
- source scripts/utils.sh
- run_timed_command "yarn install --frozen-lockfile"
- run_timed_command "yarn run webpack-prod"
- *yarn-install
- run_timed_command "retry yarn run webpack-prod"
qa-frontend-node:10:
extends: .qa-frontend-node
......@@ -266,8 +265,7 @@ webpack-dev-server:
WEBPACK_MEMORY_TEST: "true"
WEBPACK_VENDOR_DLL: "true"
script:
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
- *yarn-install
- run_timed_command "retry yarn webpack-vendor"
- run_timed_command "node --expose-gc node_modules/.bin/webpack-dev-server --config config/webpack.config.js"
artifacts:
......
......@@ -6,6 +6,14 @@
- .default-before_script
- .rails-cache
.base-script: &base-script
# Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source ./scripts/rspec_helpers.sh
.rspec-base:
extends: .rails-job-base
stage: test
......@@ -14,12 +22,7 @@
RUBY_GC_MALLOC_LIMIT_MAX: 134217728
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets"]
script:
# Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source scripts/rspec_helpers.sh
- *base-script
- rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag ~level:migration"
artifacts:
expire_in: 31d
......@@ -38,12 +41,7 @@
.rspec-base-migration:
extends: .rails:rules:ee-and-foss-migration
script:
# Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source scripts/rspec_helpers.sh
- *base-script
- rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag level:migration"
.rspec-base-pg11:
......@@ -76,12 +74,7 @@
.rspec-ee-base-geo:
extends: .rspec-base
script:
# Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source scripts/rspec_helpers.sh
- *base-script
- rspec_paralellized_job "--tag ~quarantine --tag geo"
.rspec-ee-base-geo-pg11:
......@@ -318,8 +311,7 @@ gitlab:setup:
# db/fixtures/development/04_project.rb thanks to SIZE=1 below
- git clone https://gitlab.com/gitlab-org/gitlab-test.git
/home/git/repositories/gitlab-org/gitlab-test.git
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- *base-script
- force=yes SIZE=1 FIXTURE_PATH="db/fixtures/development" bundle exec rake gitlab:setup
artifacts:
when: on_failure
......@@ -542,9 +534,7 @@ rspec fail-fast:
stage: test
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets", "detect-tests"]
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source scripts/rspec_helpers.sh
- *base-script
- rspec_fail_fast tmp/matching_tests.txt "--tag ~quarantine"
artifacts:
expire_in: 7d
......@@ -557,9 +547,7 @@ rspec foss-impact:
- .rails:rules:rspec-foss-impact
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets as-if-foss", "detect-tests as-if-foss"]
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
- source scripts/rspec_helpers.sh
- *base-script
- rspec_matched_foss_tests tmp/matching_foss_tests.txt "--tag ~quarantine"
artifacts:
expire_in: 7d
......
......@@ -16,6 +16,11 @@ review-cleanup:
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
- gcp_cleanup
.base-before_script: &base-before_script
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- install_api_client_dependencies_with_apk
review-build-cng:
extends:
- .default-retry
......@@ -23,7 +28,7 @@ review-build-cng:
image: ruby:2.6-alpine
stage: review-prepare
before_script:
- source scripts/utils.sh
- source ./scripts/utils.sh
- install_api_client_dependencies_with_apk
- install_gitlab_gem
needs:
......@@ -62,9 +67,7 @@ review-deploy:
- export GITALY_VERSION=$(<GITALY_SERVER_VERSION)
- export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION)
- echo "${CI_ENVIRONMENT_URL}" > environment_url.txt
- source ./scripts/utils.sh
- install_api_client_dependencies_with_apk
- source scripts/review_apps/review-apps.sh
- *base-before_script
script:
- check_kube_domain
- ensure_namespace
......@@ -97,9 +100,7 @@ review-deploy:
# See https://gitlab.com/gitlab-org/gitlab/issues/191273
GIT_DEPTH: 1
before_script:
- apk add --update openssl
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- *base-before_script
review-stop-failed-deployment:
extends:
......@@ -142,8 +143,7 @@ review-stop:
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
- echo "${CI_ENVIRONMENT_URL}"
- echo "${QA_IMAGE}"
- source scripts/utils.sh
- install_api_client_dependencies_with_apk
- *base-before_script
- gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}}
artifacts:
paths:
......@@ -231,6 +231,6 @@ danger-review:
stage: test
needs: []
script:
- source scripts/utils.sh
- retry yarn install --frozen-lockfile
- source ./scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
- danger --fail-on-errors=true --verbose
......@@ -38,6 +38,6 @@ update-tests-metadata:
- rspec-ee integration pg11 geo
- rspec-ee system pg11 geo
script:
- retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document
- source scripts/rspec_helpers.sh
- run_timed_command "retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document"
- source ./scripts/rspec_helpers.sh
- update_tests_metadata
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment