summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-11-06 23:59:25 +0100
committerRémy Coutable <remy@rymai.me>2018-11-26 14:49:03 +0100
commitf4b8ecbf9f8b2c47a7a8057f218c82ad77e94d66 (patch)
tree835ef15072b3ed705e5827d02f04841183c53c5a /.gitlab-ci.yml
parent99757d9657dc4a790a3c37b9d95d1666817596bc (diff)
downloadgitlab-ce-f4b8ecbf9f8b2c47a7a8057f218c82ad77e94d66.tar.gz
Add a manual job to run QA against a Review App49570-add-review_qa-job
1. Renames review to review-deploy. 2. Renames stop_review to review-stop. 3. Adds a build-qa-image job to the prepare stage and save the QA Docker image as artifact (example: https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/120967019). 4. Adds a manual review-qa job to the test stage to run QA tests against the Review App (example: https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/120967238). 5. Make the review-deploy job plays the review-qa job as soon as the Review App is deployed (example: https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/120988775). 6. Updates the Review Apps documentation accordingly. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml156
1 files changed, 108 insertions, 48 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c6cf7475afa..767df35bb42 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
@@ -875,85 +919,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
@@ -962,3 +1018,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