debian-mirror-gitlab/.gitlab/ci/review-apps/qa.gitlab-ci.yml
2022-07-17 14:43:12 +02:00

180 lines
5.1 KiB
YAML

include:
- project: gitlab-org/quality/pipeline-common
ref: 0.6.0
file:
- /ci/allure-report.yml
- /ci/knapsack-report.yml
.bundler_variables:
variables:
BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES: "true"
BUNDLE_SILENCE_ROOT_WARNING: "true"
BUNDLE_PATH: vendor
.test_variables:
variables:
QA_DEBUG: "true"
QA_GENERATE_ALLURE_REPORT: "true"
GITLAB_USERNAME: "root"
GITLAB_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}"
GITLAB_ADMIN_USERNAME: "root"
GITLAB_ADMIN_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}"
GITLAB_QA_ADMIN_ACCESS_TOKEN: "${REVIEW_APPS_ROOT_TOKEN}"
GITHUB_ACCESS_TOKEN: "${REVIEW_APPS_QA_GITHUB_ACCESS_TOKEN}"
.review-qa-base:
extends:
- .use-docker-in-docker
- .qa-cache
- .test_variables
- .bundler_variables
image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/debian-bullseye-ruby-2.7:bundler-2.3-git-2.33-lfs-2.9-chrome-99-docker-20.10.14-gcloud-383-kubectl-1.23
stage: qa
needs:
- review-deploy
- download-knapsack-report
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: /certs
DOCKER_CERT_PATH: /certs/client
DOCKER_TLS_VERIFY: 1
before_script:
- export EE_LICENSE="$(cat $REVIEW_APPS_EE_LICENSE_FILE)"
- export QA_GITLAB_URL="$(cat environment_url.txt)"
- cd qa && bundle install
script:
- qa_run_status=0
- |
bundle exec rake "knapsack:rspec[\
${RSPEC_TAGS} \
--tag ~orchestrated \
--tag ~transient \
--tag ~skip_signup_disabled \
--force-color \
--order random \
--format documentation \
--format RspecJunitFormatter --out tmp/rspec.xml \
]" || qa_run_status=$?
- if [ ${qa_run_status} -ne 0 ]; then
release_sha=$(echo "${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-${CI_COMMIT_SHA}}" | cut -c1-11);
echo "Errors can be found at https://sentry.gitlab.net/gitlab/gitlab-review-apps/releases/${release_sha}/all-events/.";
fi
- exit ${qa_run_status}
artifacts:
paths:
- qa/tmp
reports:
junit: qa/tmp/rspec.xml
expire_in: 7 days
when: always
.allure-report-base:
extends: .generate-allure-report-base
stage: post-qa
variables:
GITLAB_AUTH_TOKEN: $GITLAB_QA_MR_ALLURE_REPORT_TOKEN
ALLURE_PROJECT_PATH: $CI_PROJECT_PATH
ALLURE_MERGE_REQUEST_IID: $CI_MERGE_REQUEST_IID
ALLURE_RESULTS_GLOB: qa/tmp/allure-results/*
# Store knapsack report as artifact so the same report is reused across all jobs
download-knapsack-report:
image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/debian-bullseye-ruby-2.7:bundler-2.3-git-2.33-chrome-99
extends:
- .qa-cache
- .bundler_variables
- .review:rules:review-qa-reliable
stage: prepare
before_script:
- cd qa && bundle install
script:
- QA_KNAPSACK_REPORT_NAME=review-qa-reliable bundle exec rake "knapsack:download"
- QA_KNAPSACK_REPORT_NAME=review-qa-all bundle exec rake "knapsack:download"
allow_failure: true
artifacts:
paths:
- qa/knapsack/review-qa-*.json
expire_in: 1 day
review-qa-smoke:
extends:
- .review-qa-base
- .review:rules:review-qa-smoke
variables:
QA_RUN_TYPE: review-qa-smoke
RSPEC_TAGS: --tag smoke
review-qa-reliable:
extends:
- .review-qa-base
- .review:rules:review-qa-reliable
parallel: 10
variables:
QA_RUN_TYPE: review-qa-reliable
RSPEC_TAGS: --tag reliable
review-qa-all:
extends:
- .review-qa-base
- .review:rules:review-qa-all
parallel: 5
variables:
QA_RUN_TYPE: review-qa-all
RSPEC_TAGS: --tag ~reliable --tag ~smoke
review-performance:
extends:
- .default-retry
- .review:rules:review-performance
image:
name: sitespeedio/sitespeed.io
entrypoint: [""]
stage: qa
needs: ["review-deploy"]
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
# Generate single report for both smoke and reliable test jobs
# Both job types are essentially the same:
# * always executed
# * always blocking
allure-report-qa-blocking:
extends:
- .allure-report-base
- .review:rules:review-qa-blocking-report
needs:
- review-qa-smoke
- review-qa-reliable
variables:
ALLURE_JOB_NAME: review-qa-blocking
allure-report-qa-all:
extends:
- .allure-report-base
- .review:rules:review-qa-all-report
needs: ["review-qa-all"]
variables:
ALLURE_JOB_NAME: review-qa-all
upload-knapsack-report:
extends:
- .generate-knapsack-report-base
stage: post-qa
variables:
# knapsack report upload uses gitlab-qa image with code already there
GIT_STRATEGY: none
QA_KNAPSACK_REPORT_FILE_PATTERN: $CI_PROJECT_DIR/qa/tmp/knapsack/*/*.json