debian-mirror-gitlab/.gitlab/ci/review.gitlab-ci.yml

277 lines
8.6 KiB
YAML
Raw Normal View History

2020-05-24 23:13:21 +05:30
review-cleanup:
2019-12-21 20:55:43 +05:30
extends:
- .default-retry
2020-03-13 15:44:24 +05:30
- .review:rules:review-cleanup
2020-05-24 23:13:21 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-helm3-kubectl1.14
2019-12-21 20:55:43 +05:30
stage: prepare
environment:
name: review/auto-cleanup
action: stop
before_script:
- source scripts/utils.sh
2020-05-24 23:13:21 +05:30
- source scripts/review_apps/gcp_cleanup.sh
2019-12-21 20:55:43 +05:30
- install_gitlab_gem
2020-05-24 23:13:21 +05:30
- setup_gcp_dependencies
2019-12-21 20:55:43 +05:30
script:
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
2020-04-22 19:07:51 +05:30
- gcp_cleanup
2021-01-03 14:25:43 +05:30
.base-before_script: &base-before_script
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- install_api_client_dependencies_with_apk
2020-07-28 23:09:34 +05:30
review-build-cng:
extends:
- .default-retry
- .review:rules:review-build-cng
2021-03-11 19:13:27 +05:30
image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine
2020-07-28 23:09:34 +05:30
stage: review-prepare
before_script:
2021-01-03 14:25:43 +05:30
- source ./scripts/utils.sh
2020-07-28 23:09:34 +05:30
- install_gitlab_gem
needs:
- job: compile-production-assets
artifacts: false
script:
2021-06-08 01:23:25 +05:30
- ./scripts/trigger-build cng
2019-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
.review-workflow-base:
2019-12-21 20:55:43 +05:30
extends:
- .default-retry
2021-09-04 01:27:46 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-helm3.5-kubectl1.17
2019-07-31 22:56:46 +05:30
variables:
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
2021-09-04 01:27:46 +05:30
GITLAB_HELM_CHART_REF: "v4.12.0"
2019-12-04 20:38:33 +05:30
environment:
2020-11-24 15:15:51 +05:30
name: review/${CI_COMMIT_REF_SLUG}${FREQUENCY}
2019-07-31 22:56:46 +05:30
url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}
on_stop: review-stop
2020-04-08 14:13:33 +05:30
auto_stop_in: 48 hours
2019-12-26 22:10:19 +05:30
2020-07-28 23:09:34 +05:30
review-deploy:
extends:
- .review-workflow-base
2020-11-24 15:15:51 +05:30
- .review:rules:review-deploy
2021-09-04 01:27:46 +05:30
retry: 2
2020-07-28 23:09:34 +05:30
stage: review
2021-06-08 01:23:25 +05:30
needs: ["review-build-cng"]
2020-07-28 23:09:34 +05:30
resource_group: "review/${CI_COMMIT_REF_NAME}"
before_script:
- export GITLAB_SHELL_VERSION=$(<GITLAB_SHELL_VERSION)
- export GITALY_VERSION=$(<GITALY_SERVER_VERSION)
- export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION)
- echo "${CI_ENVIRONMENT_URL}" > environment_url.txt
2021-01-03 14:25:43 +05:30
- *base-before_script
2020-07-28 23:09:34 +05:30
script:
- check_kube_domain
2021-09-04 01:27:46 +05:30
- "ensure_namespace ${KUBE_NAMESPACE}"
2020-07-28 23:09:34 +05:30
- install_external_dns
- download_chart
- date
- deploy || (display_deployment_debug && exit 1)
2021-09-04 01:27:46 +05:30
- verify_deploy || exit 1
2021-01-03 14:25:43 +05:30
- disable_sign_ups || (delete_release && exit 1)
2020-11-24 15:15:51 +05:30
after_script:
# Run seed-dast-test-data.sh only when DAST_RUN is set to true. This is to pupulate review app with data for DAST scan.
# Set DAST_RUN to true when jobs are manually scheduled.
- if [ "$DAST_RUN" == "true" ]; then source scripts/review_apps/seed-dast-test-data.sh; TRACE=1 trigger_proj_user_creation; fi
2020-07-28 23:09:34 +05:30
artifacts:
2021-09-04 01:27:46 +05:30
paths:
- environment_url.txt
- curl_output.txt
2021-01-03 14:25:43 +05:30
expire_in: 7 days
2020-07-28 23:09:34 +05:30
when: always
2019-07-31 22:56:46 +05:30
2020-03-13 15:44:24 +05:30
.review-stop-base:
extends: .review-workflow-base
2019-07-31 22:56:46 +05:30
environment:
action: stop
2020-03-13 15:44:24 +05:30
dependencies: []
2019-12-04 20:38:33 +05:30
variables:
2020-03-13 15:44:24 +05:30
# We're cloning the repo instead of downloading the script for now
# because some repos are private and CI_JOB_TOKEN cannot access files.
# See https://gitlab.com/gitlab-org/gitlab/issues/191273
GIT_DEPTH: 1
2019-12-04 20:38:33 +05:30
before_script:
2021-01-03 14:25:43 +05:30
- *base-before_script
2019-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
review-stop-failed-deployment:
2020-03-13 15:44:24 +05:30
extends:
- .review-stop-base
2020-05-24 23:13:21 +05:30
- .review:rules:review-stop-failed-deployment
2019-12-04 20:38:33 +05:30
stage: prepare
script:
- delete_failed_release
2019-12-26 22:10:19 +05:30
review-stop:
2020-03-13 15:44:24 +05:30
extends:
- .review-stop-base
2020-11-24 15:15:51 +05:30
- .review:rules:review-stop
stage: post-qa
2019-12-26 22:10:19 +05:30
script:
- delete_release
2020-07-28 23:09:34 +05:30
.review-qa-base:
extends:
- .use-docker-in-docker
2021-01-29 00:20:46 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7
2020-07-28 23:09:34 +05:30
stage: qa
2021-06-08 01:23:25 +05:30
needs: ["review-deploy"]
2020-07-28 23:09:34 +05:30
variables:
QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa"
QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
QA_DEBUG: "true"
2021-09-04 01:27:46 +05:30
QA_GENERATE_ALLURE_REPORT: "true"
2020-07-28 23:09:34 +05:30
GITLAB_USERNAME: "root"
GITLAB_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}"
GITLAB_ADMIN_USERNAME: "root"
GITLAB_ADMIN_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}"
GITHUB_ACCESS_TOKEN: "${REVIEW_APPS_QA_GITHUB_ACCESS_TOKEN}"
EE_LICENSE: "${REVIEW_APPS_EE_LICENSE}"
SIGNUP_DISABLED: "true"
before_script:
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_REF_SLUG}"
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
- echo "${CI_ENVIRONMENT_URL}"
- echo "${QA_IMAGE}"
2021-01-03 14:25:43 +05:30
- *base-before_script
2020-07-28 23:09:34 +05:30
- gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}}
artifacts:
paths:
- ./qa/gitlab-qa-run-*
expire_in: 7 days
when: always
2021-09-04 01:27:46 +05:30
.allure-report-base:
image:
name: ${GITLAB_DEPENDENCY_PROXY}andrcuns/allure-report-publisher:0.3.2
entrypoint: [""]
stage: post-qa
variables:
GIT_STRATEGY: none
STORAGE_CREDENTIALS: $QA_ALLURE_REPORT_GCS_CREDENTIALS
GITLAB_AUTH_TOKEN: $GITLAB_QA_MR_ALLURE_REPORT_TOKEN
allow_failure: true
script:
- |
allure-report-publisher upload gcs \
--results-glob="qa/gitlab-qa-run-*/**/allure-results/*" \
--bucket="gitlab-qa-allure-reports" \
--prefix="$ALLURE_REPORT_PATH_PREFIX/$CI_COMMIT_REF_SLUG" \
--update-pr="comment" \
--copy-latest \
--ignore-missing-results \
--color
2020-07-28 23:09:34 +05:30
review-qa-smoke:
extends:
- .review-qa-base
- .review:rules:review-qa-smoke
2021-09-04 01:27:46 +05:30
retry: 1 # This is confusing but this means "2 runs at max".
2020-07-28 23:09:34 +05:30
script:
- gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
review-qa-all:
extends:
- .review-qa-base
2021-04-29 21:17:54 +05:30
- .review:rules:review-qa-all
2020-07-28 23:09:34 +05:30
parallel: 5
script:
- export KNAPSACK_REPORT_PATH=knapsack/master_report.json
- export KNAPSACK_TEST_FILE_PATTERN=qa/specs/features/**/*_spec.rb
- gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" -- --format RspecJunitFormatter --out tmp/rspec-${CI_JOB_ID}.xml --format html --out tmp/rspec.htm --color --format documentation
review-performance:
extends:
- .default-retry
2020-11-24 15:15:51 +05:30
- .review:rules:review-performance
2020-07-28 23:09:34 +05:30
image:
2021-01-03 14:25:43 +05:30
name: sitespeedio/sitespeed.io
2020-07-28 23:09:34 +05:30
entrypoint: [""]
stage: qa
2021-06-08 01:23:25 +05:30
needs: ["review-deploy"]
2020-07-28 23:09:34 +05:30
before_script:
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
- echo "${CI_ENVIRONMENT_URL}"
- mkdir -p gitlab-exporter
- wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/master/index.js
- mkdir -p sitespeed-results
script:
- /start.sh --plugins.add ./gitlab-exporter --outputFolder sitespeed-results "${CI_ENVIRONMENT_URL}"
after_script:
- mv sitespeed-results/data/performance.json performance.json
artifacts:
paths:
- sitespeed-results/
reports:
performance: performance.json
expire_in: 31d
parallel-spec-reports:
extends:
2021-04-29 21:17:54 +05:30
- .review:rules:review-qa-all
2021-03-11 19:13:27 +05:30
image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine
2020-07-28 23:09:34 +05:30
stage: post-qa
2021-06-08 01:23:25 +05:30
needs: ["review-qa-all"]
2020-07-28 23:09:34 +05:30
variables:
NEW_PARALLEL_SPECS_REPORT: qa/report-new.html
BASE_ARTIFACT_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/qa/"
script:
- apk add --update build-base libxml2-dev libxslt-dev && rm -rf /var/cache/apk/*
- gem install nokogiri --no-document
- cd qa/gitlab-qa-run-*/gitlab-*
- ARTIFACT_DIRS=$(pwd |rev| awk -F / '{print $1,$2}' | rev | sed s_\ _/_)
- cd -
- '[[ -f $NEW_PARALLEL_SPECS_REPORT ]] || echo "{}" > ${NEW_PARALLEL_SPECS_REPORT}'
- scripts/merge-html-reports ${NEW_PARALLEL_SPECS_REPORT} ${BASE_ARTIFACT_URL}${ARTIFACT_DIRS} qa/gitlab-qa-run-*/**/rspec.htm
artifacts:
when: always
paths:
- qa/report-new.html
- qa/gitlab-qa-run-*
reports:
junit: qa/gitlab-qa-run-*/**/rspec-*.xml
expire_in: 31d
2019-07-31 22:56:46 +05:30
2021-09-04 01:27:46 +05:30
allure-report-qa-smoke:
extends:
- .allure-report-base
- .review:rules:review-qa-smoke-report
needs: ["review-qa-smoke"]
variables:
ALLURE_REPORT_PATH_PREFIX: gitlab-review-smoke
ALLURE_JOB_NAME: review-qa-smoke
allure-report-qa-all:
extends:
- .allure-report-base
- .review:rules:review-qa-all-report
needs: ["review-qa-all"]
variables:
ALLURE_REPORT_PATH_PREFIX: gitlab-review-all
ALLURE_JOB_NAME: review-qa-all
2019-07-31 22:56:46 +05:30
danger-review:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
2021-04-17 20:07:23 +05:30
- .danger-review-cache
2020-03-13 15:44:24 +05:30
- .review:rules:danger
2019-07-31 22:56:46 +05:30
stage: test
2020-04-08 14:13:33 +05:30
needs: []
2021-04-17 20:07:23 +05:30
before_script:
2021-06-08 01:23:25 +05:30
- source scripts/utils.sh
- bundle_install_script "--with danger"
2021-01-03 14:25:43 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
2021-04-17 20:07:23 +05:30
script:
2021-04-29 21:17:54 +05:30
- >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
# Force danger to skip CI source GitLab and fallback to "local only git repo".
unset GITLAB_CI
# We need to base SHA to help danger determine the base commit for this shallow clone.
run_timed_command "bundle exec danger dry_run --fail-on-errors=true --verbose --base='$CI_MERGE_REQUEST_DIFF_BASE_SHA'"
else
run_timed_command "bundle exec danger --fail-on-errors=true --verbose"
fi