diff options
author | Sean McGivern <sean@gitlab.com> | 2018-11-28 10:39:56 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-11-28 10:39:56 +0000 |
commit | e8db29d086b9f6a51bc820dc96925c09eabdf5a5 (patch) | |
tree | 7ba3d34bf11a93d8bdaecc44fd1535cc8e250310 /.gitlab-ci.yml | |
parent | 8cb6b66f3ccfb945da3961b783f265fdb13eb39e (diff) | |
parent | f4b8ecbf9f8b2c47a7a8057f218c82ad77e94d66 (diff) | |
download | gitlab-ce-e8db29d086b9f6a51bc820dc96925c09eabdf5a5.tar.gz |
Merge branch '49570-add-review_qa-job' into 'master'
Add an automatic job to run QA smoke tests against Review Apps
Closes #49570
See merge request gitlab-org/gitlab-ce!22853
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 156 |
1 files changed, 108 insertions, 48 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c521b03863..7297d1f0eb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -439,6 +439,50 @@ setup-test-env: - config/secrets.yml - vendor/gitaly-ruby +# GitLab Review apps +.review-base: &review-base + <<: *dedicated-no-docs-no-db-pull-cache-job + image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base + stage: test + cache: {} + dependencies: [] + environment: &review-environment + name: review/${CI_COMMIT_REF_NAME} + url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN} + only: + refs: + - branches@gitlab-org/gitlab-ce + - branches@gitlab-org/gitlab-ee + kubernetes: active + except: + refs: + - master + - /(^docs[\/-].*|.*-docs$)/ + before_script: [] + +.review-docker: &review-docker + <<: *review-base + image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine + services: + - docker:stable-dind + tags: + - gitlab-org + - docker + variables: &review-docker-variables + GIT_DEPTH: "1" + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://docker:2375 + LATEST_QA_IMAGE: "gitlab/${CI_PROJECT_NAME}-qa:nightly" + QA_IMAGE: "${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/${CI_PROJECT_NAME}-qa:${CI_COMMIT_REF_SLUG}" + +build-qa-image: + <<: *review-docker + stage: prepare + script: + - time docker build --cache-from ${LATEST_QA_IMAGE} --tag ${QA_IMAGE} ./qa/ + - echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} + - time docker push ${QA_IMAGE} + danger-review: <<: *pull-cache image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger @@ -876,85 +920,97 @@ no_ee_check: - //@gitlab-org/gitlab-ce # GitLab Review apps -review: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base - stage: test - allow_failure: true - before_script: - - gem install gitlab --no-document +review-deploy: + <<: *review-base variables: GIT_DEPTH: "1" - HOST_SUFFIX: "$CI_ENVIRONMENT_SLUG" - DOMAIN: "-$CI_ENVIRONMENT_SLUG.$REVIEW_APPS_DOMAIN" + HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}" + DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}" GITLAB_HELM_CHART_REF: "master" + API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" + environment: + <<: *review-environment + on_stop: review-stop + before_script: + - apk update && apk add jq + - gem install gitlab --no-document script: - export GITLAB_SHELL_VERSION=$(<GITLAB_SHELL_VERSION) - export GITALY_VERSION=$(<GITALY_SERVER_VERSION) - export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION) - source ./scripts/review_apps/review-apps.sh + - wait_for_job_to_be_done "gitlab:assets:compile" - BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng - check_kube_domain - download_gitlab_chart - ensure_namespace - install_tiller - install_external_dns - - deploy - environment: - name: review/$CI_COMMIT_REF_NAME - url: https://gitlab-$CI_ENVIRONMENT_SLUG.$REVIEW_APPS_DOMAIN - on_stop: stop_review - only: - refs: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - kubernetes: active - except: - refs: - - master - - /(^docs[\/-].*|.*-docs$)/ + - time deploy + - add_license + +.review-qa-base: &review-qa-base + <<: *review-docker + variables: + <<: *review-docker-variables + API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" + QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa" + QA_CAN_TEST_GIT_PROTOCOL_V2: "false" + 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}" + artifacts: + paths: + - ./qa/gitlab-qa-run-* + expire_in: 7 days + when: always + before_script: + - echo "${QA_IMAGE}" + - echo "${CI_ENVIRONMENT_URL}" + - apk update && apk add curl jq + - source ./scripts/review_apps/review-apps.sh + - gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}} + - wait_for_job_to_be_done "review-deploy" + +review-qa-smoke: + <<: *review-qa-base + script: + - gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" + +review-qa-all: + <<: *review-qa-base + script: + - gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" + when: manual -stop_review: +review-stop: + <<: *review-base <<: *single-script-job image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base - stage: test allow_failure: true - cache: {} - dependencies: [] variables: + <<: *single-script-job-variables SCRIPT_NAME: "review_apps/review-apps.sh" + when: manual + environment: + <<: *review-environment + action: stop script: - source $(basename "${SCRIPT_NAME}") - delete - cleanup - when: manual - environment: - name: review/$CI_COMMIT_REF_NAME - action: stop - only: - refs: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - kubernetes: active - except: - - master - - /(^docs[\/-].*|.*-docs$)/ -schedule:review_apps_cleanup: - <<: *dedicated-no-docs-pull-cache-job - image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base +schedule:review-cleanup: + <<: *review-base stage: build allow_failure: true - cache: {} - dependencies: [] - before_script: - - gem install gitlab --no-document variables: GIT_DEPTH: "1" - script: - - ruby -rrubygems scripts/review_apps/automated_cleanup.rb environment: name: review/auto-cleanup - action: stop only: refs: - schedules@gitlab-org/gitlab-ce @@ -963,3 +1019,7 @@ schedule:review_apps_cleanup: except: - tags - /(^docs[\/-].*|.*-docs$)/ + before_script: + - gem install gitlab --no-document + script: + - ruby -rrubygems scripts/review_apps/automated_cleanup.rb |