356 lines
11 KiB
YAML
356 lines
11 KiB
YAML
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
|
|
.if-canonical-dot-com-gitlab-org-group-schedule: &if-canonical-dot-com-gitlab-org-group-schedule
|
|
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" && $CI_PIPELINE_SOURCE == "schedule"'
|
|
|
|
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
|
|
.if-canonical-gitlab-merge-request: &if-canonical-gitlab-merge-request
|
|
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" && $CI_MERGE_REQUEST_IID'
|
|
|
|
# Make sure to update all the similar patterns in other CI config files if you modify these patterns
|
|
.code-qa-patterns: &code-qa-patterns
|
|
- ".gitlab/ci/**/*"
|
|
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
|
|
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
|
|
- ".csscomb.json"
|
|
- "Dockerfile.assets"
|
|
- "*_VERSION"
|
|
- "Gemfile{,.lock}"
|
|
- "Rakefile"
|
|
- "{babel.config,jest.config}.js"
|
|
- "config.ru"
|
|
- "{package.json,yarn.lock}"
|
|
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
|
|
- "doc/api/graphql/reference/*" # Files in this folder are auto-generated
|
|
# QA changes
|
|
- ".dockerignore"
|
|
- "qa/**/*"
|
|
|
|
.review-docker:
|
|
extends:
|
|
- .default-tags
|
|
- .default-retry
|
|
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.6
|
|
services:
|
|
- docker:19.03.0-dind
|
|
tags:
|
|
- gitlab-org
|
|
- docker
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375
|
|
GITLAB_EDITION: "ce"
|
|
|
|
build-qa-image:
|
|
extends: .review-docker
|
|
stage: prepare
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: on_success
|
|
- <<: *if-canonical-dot-com-gitlab-org-group-schedule
|
|
when: on_success
|
|
script:
|
|
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
|
|
- export QA_MASTER_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:master"
|
|
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
|
|
- echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
|
|
- time docker pull "${QA_MASTER_IMAGE}"
|
|
- time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./
|
|
- time docker push ${QA_IMAGE}
|
|
|
|
.base-review-cleanup:
|
|
extends:
|
|
- .default-tags
|
|
- .default-retry
|
|
- .default-only
|
|
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
|
|
|
|
schedule:review-cleanup:
|
|
extends:
|
|
- .base-review-cleanup
|
|
- .only-review-schedules
|
|
|
|
manual:review-cleanup:
|
|
extends:
|
|
- .base-review-cleanup
|
|
- .only:changes-code-qa
|
|
when: manual
|
|
|
|
.review-build-cng-base:
|
|
extends:
|
|
- .default-tags
|
|
- .default-retry
|
|
- .default-only
|
|
image: ruby:2.6-alpine
|
|
stage: review-prepare
|
|
before_script:
|
|
- source scripts/utils.sh
|
|
- install_api_client_dependencies_with_apk
|
|
- install_gitlab_gem
|
|
dependencies: []
|
|
script:
|
|
- BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng
|
|
|
|
review-build-cng:
|
|
extends:
|
|
- .review-build-cng-base
|
|
- .only-review
|
|
- .only:changes-code-qa
|
|
needs: ["gitlab:assets:compile pull-cache"]
|
|
|
|
schedule:review-build-cng:
|
|
extends:
|
|
- .review-build-cng-base
|
|
- .only-review-schedules
|
|
needs: ["gitlab:assets:compile pull-cache"]
|
|
|
|
.review-workflow-base:
|
|
extends:
|
|
- .default-tags
|
|
- .default-retry
|
|
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
|
|
dependencies: []
|
|
variables:
|
|
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
|
|
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
|
|
GITLAB_HELM_CHART_REF: "v2.5.1"
|
|
GITLAB_EDITION: "ce"
|
|
environment:
|
|
name: review/${CI_COMMIT_REF_NAME}
|
|
url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}
|
|
on_stop: review-stop
|
|
|
|
.review-deploy-base:
|
|
extends: .review-workflow-base
|
|
stage: review
|
|
allow_failure: true
|
|
before_script:
|
|
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
|
|
- export GITLAB_SHELL_VERSION=$(<GITLAB_SHELL_VERSION)
|
|
- export GITALY_VERSION=$(<GITALY_SERVER_VERSION)
|
|
- export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION)
|
|
- echo "${CI_ENVIRONMENT_URL}" > review_app_url.txt
|
|
- source scripts/utils.sh
|
|
- install_api_client_dependencies_with_apk
|
|
- source scripts/review_apps/review-apps.sh
|
|
script:
|
|
- check_kube_domain
|
|
- ensure_namespace
|
|
- install_tiller
|
|
- install_external_dns
|
|
- download_chart
|
|
- date
|
|
- deploy || (display_deployment_debug && exit 1)
|
|
artifacts:
|
|
paths: [review_app_url.txt]
|
|
expire_in: 2 days
|
|
when: always
|
|
|
|
review-deploy:
|
|
extends: .review-deploy-base
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: on_success
|
|
|
|
schedule:review-deploy:
|
|
extends:
|
|
- .review-deploy-base
|
|
- .only-review-schedules
|
|
|
|
.base-review-stop:
|
|
extends: .review-workflow-base
|
|
environment:
|
|
action: stop
|
|
variables:
|
|
# 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
|
|
before_script:
|
|
- apk add --update openssl
|
|
- source ./scripts/utils.sh
|
|
- source ./scripts/review_apps/review-apps.sh
|
|
|
|
review-stop-failed-deployment:
|
|
extends: .base-review-stop
|
|
stage: prepare
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: on_success
|
|
script:
|
|
- delete_failed_release
|
|
|
|
review-stop:
|
|
extends: .base-review-stop
|
|
stage: review
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: manual
|
|
allow_failure: true
|
|
script:
|
|
- delete_release
|
|
|
|
.review-qa-base:
|
|
extends: .review-docker
|
|
stage: qa
|
|
needs: ["review-deploy"]
|
|
dependencies: ["review-deploy"]
|
|
allow_failure: true
|
|
variables:
|
|
QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa"
|
|
QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
|
|
QA_DEBUG: "true"
|
|
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:
|
|
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
|
|
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
|
|
- export CI_ENVIRONMENT_URL="$(cat review_app_url.txt)"
|
|
- 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}}
|
|
artifacts:
|
|
paths:
|
|
- ./qa/gitlab-qa-run-*
|
|
expire_in: 7 days
|
|
when: always
|
|
|
|
review-qa-smoke:
|
|
extends: .review-qa-base
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: on_success
|
|
script:
|
|
- gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
|
|
|
|
review-qa-all:
|
|
extends: .review-qa-base
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: manual
|
|
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-base:
|
|
extends: .review-docker
|
|
stage: qa
|
|
allow_failure: true
|
|
before_script:
|
|
- export CI_ENVIRONMENT_URL="$(cat review_app_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:
|
|
- 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
|
|
|
|
review-performance:
|
|
extends: .review-performance-base
|
|
rules:
|
|
- <<: *if-canonical-gitlab-merge-request
|
|
changes: *code-qa-patterns
|
|
when: on_success
|
|
needs: ["review-deploy"]
|
|
dependencies: ["review-deploy"]
|
|
before_script:
|
|
- export CI_ENVIRONMENT_URL="$(cat review_app_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:
|
|
- 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
|
|
|
|
schedule:review-performance:
|
|
extends:
|
|
- .review-performance-base
|
|
- .only-review-schedules
|
|
needs: ["schedule:review-deploy"]
|
|
dependencies: ["schedule:review-deploy"]
|
|
|
|
parallel-spec-reports:
|
|
extends:
|
|
- .default-tags
|
|
- .default-only
|
|
- .only-review
|
|
- .only:changes-code-qa
|
|
image: ruby:2.6-alpine
|
|
stage: post-qa
|
|
dependencies: ["review-qa-all"]
|
|
variables:
|
|
NEW_PARALLEL_SPECS_REPORT: qa/report-new.html
|
|
BASE_ARTIFACT_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/qa/"
|
|
allow_failure: true
|
|
when: manual
|
|
artifacts:
|
|
when: always
|
|
paths:
|
|
- qa/report-new.html
|
|
- qa/gitlab-qa-run-*
|
|
reports:
|
|
junit: qa/gitlab-qa-run-*/**/rspec-*.xml
|
|
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
|
|
|
|
danger-review:
|
|
extends:
|
|
- .default-tags
|
|
- .default-retry
|
|
- .default-cache
|
|
- .default-only
|
|
- .except:refs-master-tags-stable-deploy
|
|
image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger
|
|
stage: test
|
|
dependencies: []
|
|
only:
|
|
variables:
|
|
- $DANGER_GITLAB_API_TOKEN
|
|
script:
|
|
- git version
|
|
- node --version
|
|
- yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
|
|
- danger --fail-on-errors=true
|