summaryrefslogtreecommitdiff
path: root/.gitlab/ci/review-apps/qa.gitlab-ci.yml
blob: bf013abdd43889ed3b4cedc07c69baf09ba66c8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
include:
  - project: gitlab-org/quality/pipeline-common
    ref: 0.3.9
    file:
      - /ci/allure-report.yml
      - /ci/knapsack-report.yml

.review-qa-base:
  extends:
    - .use-docker-in-docker
  image:
    name: ${QA_IMAGE}
    entrypoint: [""]
  stage: qa
  needs: ["review-deploy"]
  variables:
    QA_DEBUG: "true"
    QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
    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}"
    SIGNUP_DISABLED: "true"
  before_script:
    # Use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA so that GitLab image built in omnibus-gitlab-mirror and QA image are in sync.
    - export EE_LICENSE="$(cat $REVIEW_APPS_EE_LICENSE_FILE)"
    - if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
        git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA};
      fi
    - export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
    - echo "${CI_ENVIRONMENT_URL}"
    - cd qa
  script:
    - qa_run_status=0
    - bin/test "${QA_SCENARIO}" "${CI_ENVIRONMENT_URL}" -- --color --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/*

review-qa-smoke:
  extends:
    - .review-qa-base
    - .review:rules:review-qa-smoke
  retry: 1  # This is confusing but this means "2 runs at max".
  variables:
    QA_RUN_TYPE: review-qa-smoke
    QA_SCENARIO: Test::Instance::Smoke


review-qa-reliable:
  extends:
    - .review-qa-base
    - .review:rules:review-qa-reliable
  parallel: 8
  retry: 1
  variables:
    QA_RUN_TYPE: review-qa-reliable
    QA_SCENARIO: Test::Instance::Reliable

review-qa-all:
  extends:
    - .review-qa-base
    - .review:rules:review-qa-all
  parallel: 5
  variables:
    QA_RUN_TYPE: review-qa-all
    QA_SCENARIO: Test::Instance::All
    QA_SKIP_SMOKE_RELIABLE: "true"

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

knapsack-report:
  extends:
    - .generate-knapsack-report-base
  stage: post-qa
  variables:
    QA_KNAPSACK_REPORT_FILE_PATTERN: $CI_PROJECT_DIR/tmp/knapsack/*/*.json