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

257 lines
7.8 KiB
YAML
Raw Normal View History

2019-12-04 20:38:33 +05:30
.review-docker:
extends:
- .default-tags
- .default-retry
2020-03-09 13:42:32 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.6
2019-07-31 22:56:46 +05:30
services:
2019-09-30 21:07:59 +05:30
- docker:19.03.0-dind
2019-07-31 22:56:46 +05:30
tags:
- gitlab-org
- docker
2019-12-04 20:38:33 +05:30
variables:
2019-07-31 22:56:46 +05:30
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
2019-12-04 20:38:33 +05:30
GITLAB_EDITION: "ce"
2019-07-31 22:56:46 +05:30
build-qa-image:
2019-12-04 20:38:33 +05:30
extends:
- .review-docker
2020-03-09 13:42:32 +05:30
- .review:rules:mr-and-schedule
2019-12-04 20:38:33 +05:30
stage: prepare
2019-07-31 22:56:46 +05:30
script:
2019-12-04 20:38:33 +05:30
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
2020-01-01 13:55:28 +05:30
- export QA_MASTER_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:master"
2019-12-04 20:38:33 +05:30
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
2019-07-31 22:56:46 +05:30
- echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
2020-01-01 13:55:28 +05:30
- time docker pull "${QA_MASTER_IMAGE}"
- time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./
2019-07-31 22:56:46 +05:30
- time docker push ${QA_IMAGE}
2020-03-09 13:42:32 +05:30
review-cleanup:
2019-12-21 20:55:43 +05:30
extends:
- .default-tags
- .default-retry
2020-03-09 13:42:32 +05:30
- .review:rules:review-cleanup
2019-12-21 20:55:43 +05:30
stage: prepare
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
allow_failure: true
environment:
name: review/auto-cleanup
action: stop
before_script:
- source scripts/utils.sh
- install_gitlab_gem
script:
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
2020-03-09 13:42:32 +05:30
review-build-cng:
2019-12-04 20:38:33 +05:30
extends:
2019-12-26 22:10:19 +05:30
- .default-tags
- .default-retry
2020-03-09 13:42:32 +05:30
- .review:rules:mr-and-schedule
2019-09-04 21:01:54 +05:30
image: ruby:2.6-alpine
2019-12-04 20:38:33 +05:30
stage: review-prepare
2019-07-31 22:56:46 +05:30
before_script:
- source scripts/utils.sh
- install_api_client_dependencies_with_apk
- install_gitlab_gem
2020-03-09 13:42:32 +05:30
needs:
- job: gitlab:assets:compile pull-cache
artifacts: false
2019-07-31 22:56:46 +05:30
script:
- BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng
2019-12-26 22:10:19 +05:30
.review-workflow-base:
2019-12-21 20:55:43 +05:30
extends:
- .default-tags
- .default-retry
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
2019-07-31 22:56:46 +05:30
variables:
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
2020-01-01 13:55:28 +05:30
GITLAB_HELM_CHART_REF: "v2.5.1"
2019-12-04 20:38:33 +05:30
GITLAB_EDITION: "ce"
environment:
2019-07-31 22:56:46 +05:30
name: review/${CI_COMMIT_REF_NAME}
url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}
on_stop: review-stop
2019-12-26 22:10:19 +05:30
2020-03-09 13:42:32 +05:30
review-deploy:
extends:
- .review-workflow-base
- .review:rules:mr-and-schedule
2019-12-26 22:10:19 +05:30
stage: review
2020-03-09 13:42:32 +05:30
needs:
- job: review-build-cng
artifacts: false
2019-12-26 22:10:19 +05:30
allow_failure: true
2019-07-31 22:56:46 +05:30
before_script:
2019-12-04 20:38:33 +05:30
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
2019-07-31 22:56:46 +05:30
- export GITLAB_SHELL_VERSION=$(<GITLAB_SHELL_VERSION)
- export GITALY_VERSION=$(<GITALY_SERVER_VERSION)
- export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION)
2020-03-09 13:42:32 +05:30
- echo "${CI_ENVIRONMENT_URL}" > environment_url.txt
- source ./scripts/utils.sh
2019-07-31 22:56:46 +05:30
- install_api_client_dependencies_with_apk
- source scripts/review_apps/review-apps.sh
script:
2019-09-30 21:07:59 +05:30
- check_kube_domain
- ensure_namespace
- install_tiller
- install_external_dns
- download_chart
2019-12-21 20:55:43 +05:30
- date
2019-10-12 21:52:04 +05:30
- deploy || (display_deployment_debug && exit 1)
2019-07-31 22:56:46 +05:30
artifacts:
2020-03-09 13:42:32 +05:30
paths: [environment_url.txt]
2019-07-31 22:56:46 +05:30
expire_in: 2 days
when: always
2020-03-09 13:42:32 +05:30
.review-stop-base:
extends: .review-workflow-base
2019-07-31 22:56:46 +05:30
environment:
action: stop
2020-03-09 13:42:32 +05:30
dependencies: []
2019-12-04 20:38:33 +05:30
variables:
2020-03-09 13:42:32 +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:
- apk add --update openssl
2020-03-09 13:42:32 +05:30
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
2019-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
review-stop-failed-deployment:
2020-03-09 13:42:32 +05:30
extends:
- .review-stop-base
- .review:rules:mr-only-auto
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-09 13:42:32 +05:30
extends:
- .review-stop-base
- .review:rules:mr-only-manual
2019-12-26 22:10:19 +05:30
stage: review
allow_failure: true
script:
- delete_release
2019-12-04 20:38:33 +05:30
.review-qa-base:
2020-03-09 13:42:32 +05:30
extends: .review-docker
2019-09-04 21:01:54 +05:30
stage: qa
2020-03-09 13:42:32 +05:30
needs:
- job: review-deploy
artifacts: true
2019-12-21 20:55:43 +05:30
allow_failure: true
2019-07-31 22:56:46 +05:30
variables:
QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa"
QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
2019-12-04 20:38:33 +05:30
QA_DEBUG: "true"
2019-07-31 22:56:46 +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}"
before_script:
2019-12-04 20:38:33 +05:30
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
2020-03-09 13:42:32 +05:30
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
2019-07-31 22:56:46 +05:30
- echo "${CI_ENVIRONMENT_URL}"
- echo "${QA_IMAGE}"
- source scripts/utils.sh
- install_api_client_dependencies_with_apk
- gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}}
2020-03-09 13:42:32 +05:30
artifacts:
paths:
- ./qa/gitlab-qa-run-*
expire_in: 7 days
when: always
2019-07-31 22:56:46 +05:30
review-qa-smoke:
2020-03-09 13:42:32 +05:30
extends:
- .review-qa-base
- .review:rules:mr-only-auto
2019-07-31 22:56:46 +05:30
script:
- gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
review-qa-all:
2020-03-09 13:42:32 +05:30
extends:
- .review-qa-base
- .review:rules:mr-only-manual
2019-09-04 21:01:54 +05:30
parallel: 5
2019-07-31 22:56:46 +05:30
script:
2019-12-21 20:55:43 +05:30
- export KNAPSACK_REPORT_PATH=knapsack/master_report.json
2019-09-04 21:01:54 +05:30
- export KNAPSACK_TEST_FILE_PATTERN=qa/specs/features/**/*_spec.rb
2019-09-30 21:07:59 +05:30
- 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
2019-12-04 20:38:33 +05:30
review-performance:
2019-12-21 20:55:43 +05:30
extends:
2020-03-09 13:42:32 +05:30
- .review-docker
- .review:rules:mr-and-schedule
stage: qa
needs:
- job: review-deploy
artifacts: true
allow_failure: true
2019-07-31 22:56:46 +05:30
before_script:
2020-03-09 13:42:32 +05:30
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
2019-07-31 22:56:46 +05:30
- 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:
- docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --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
2019-12-21 20:55:43 +05:30
parallel-spec-reports:
2019-12-04 20:38:33 +05:30
extends:
2019-12-21 20:55:43 +05:30
- .default-tags
2020-03-09 13:42:32 +05:30
- .review:rules:mr-only-manual
2019-12-21 20:55:43 +05:30
image: ruby:2.6-alpine
2020-01-01 13:55:28 +05:30
stage: post-qa
2019-12-21 20:55:43 +05:30
dependencies: ["review-qa-all"]
2020-03-09 13:42:32 +05:30
allow_failure: true
2019-12-21 20:55:43 +05:30
variables:
NEW_PARALLEL_SPECS_REPORT: qa/report-new.html
BASE_ARTIFACT_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/qa/"
2019-07-31 22:56:46 +05:30
script:
2019-12-21 20:55:43 +05:30
- 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
2020-03-09 13:42:32 +05:30
artifacts:
when: always
paths:
- qa/report-new.html
- qa/gitlab-qa-run-*
reports:
junit: qa/gitlab-qa-run-*/**/rspec-*.xml
2019-07-31 22:56:46 +05:30
danger-review:
2019-12-04 20:38:33 +05:30
extends:
- .default-tags
- .default-retry
- .default-cache
2020-03-09 13:42:32 +05:30
- .review:rules:danger
2019-07-31 22:56:46 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger
stage: test
dependencies: []
script:
- git version
- node --version
2019-09-30 21:07:59 +05:30
- yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
2019-07-31 22:56:46 +05:30
- danger --fail-on-errors=true