Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rules.gitlab-ci.yml « qa-common « ci « .gitlab - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7518f08398fae5a88e9ac2d6e4d6729e51e57b2b (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Specific specs passed
.specs-specified: &specs-specified
  if: $QA_TESTS != ""

# No specific specs passed
.all-specs: &all-specs
  if: $QA_TESTS == ""

# FF changes
.feature-flags-set: &feature-flags-set
  if: $QA_FEATURE_FLAGS =~ /enabled|disabled/

# Specific specs specified
.spec-file-specified: &spec-file-specified
  if: $QA_TESTS =~ /_spec\.rb/

# Specs directory specified
.spec-directory-specified: &spec-directory-specified
  if: $QA_TESTS != "" && $QA_TESTS !~ /_spec\.rb/

# Manually trigger job on ff changes but with default ff state instead of inverted
.feature-flags-set-manual: &feature-flags-set-manual
  <<: *feature-flags-set
  when: manual
  allow_failure: true

# Run the job on master pipeline
.default-branch: &default-branch
  if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

# Run all tests when QA framework changes present, full suite execution is explicitly enabled or a feature flag file is removed
.qa-run-all-tests: &qa-run-all-tests
  if: $QA_FRAMEWORK_CHANGES == "true" || $QA_RUN_ALL_TESTS == "true" || $QA_RUN_ALL_E2E_LABEL == "true" || $QA_FEATURE_FLAGS =~ /deleted/

# Run job when MR has pipeline:run-all-e2e label
.qa-run-all-e2e-label: &qa-run-all-e2e-label
  if: $QA_RUN_ALL_E2E_LABEL == "true"

# Process test results (notify failure to slack, create test session report, relate test failures)
.process-test-results: &process-test-results
  if: $PROCESS_TEST_RESULTS == "true"

.not-canonical-project: &not-canonical-project
  if: '$CI_PROJECT_PATH != "gitlab-org/gitlab" && $CI_PROJECT_PATH != "gitlab-cn/gitlab"'

# Selective test execution against omnibus instance have following execution scenarios:
#   * only e2e spec files changed - runs only changed specs
#   * qa framework changes - runs full test suite
#   * feature flag changed - runs full test suite with base gitlab instance configuration with both ff states
#   * quarantined e2e spec - skips execution of e2e tests by creating a no-op pipeline

# ------------------------------------------
# Prepare
# ------------------------------------------
.rules:prepare:
  rules:
    - when: always

.rules:update-cache:
  rules:
    - if: '$UPDATE_QA_CACHE == "true"'

.rules:download-knapsack:
  rules:
    - when: always

.rules:download-fast-quarantine-report:
  rules:
    - when: always

# ------------------------------------------
# Test
# ------------------------------------------
.rules:test:manual:
  rules:
    - when: manual
      allow_failure: true
      variables:
        QA_TESTS: ""

.rules:test:feature-flags-set:
  rules:
    # unset specific specs if pipeline has feature flag changes and run full suite
    - <<: *feature-flags-set
      variables:
        QA_TESTS: ""

# parallel and non parallel rules are used for jobs that require parallel execution and thus need to switch
# between parallel and non parallel when only certain specs are executed
.rules:test:qa-selective:
  rules:
    # always run parallel with full suite when framework changes present or ff state changed
    - <<: *qa-run-all-tests
      when: never
    - <<: *all-specs
      when: never
    - <<: *feature-flags-set
      when: never
    - <<: *spec-directory-specified
      when: never

.rules:test:qa-selective-parallel:
  rules:
    # always run parallel with full suite when framework changes present or ff state changed
    - <<: *qa-run-all-tests
      when: never
    - <<: *all-specs
      when: never
    - <<: *feature-flags-set
      when: never
    - <<: *spec-file-specified
      when: never

.rules:test:qa-parallel:
  rules:
    - *qa-run-all-tests
    - <<: *specs-specified
      when: manual
      allow_failure: true
      variables:
        QA_TESTS: ""
    - *feature-flags-set-manual

# general qa job rule for jobs without the need to run in parallel
.rules:test:qa:
  rules:
    - *qa-run-all-tests
    - *feature-flags-set-manual

.rules:test:ce-only:
  rules:
    - if: $FOSS_ONLY != "1"
      when: never

.rules:test:ee-only:
  rules:
    - if: $FOSS_ONLY == "1"
      when: never

.rules:test:update:
  rules:
    # skip upgrade jobs if gitlab version is not in semver compatible format
    # these jobs need gitlab version because we can't reliably detect it from just the image
    - if: $GITLAB_SEMVER_VERSION !~ /^\d+\.\d+\.\d+/
      when: never
    # $QA_SUPER_SIDEBAR_ENABLED is now only present as a variable when testing old nav so we skip update jobs
    # in pipeline where it is explicitly disabled
    - if: $QA_SUPER_SIDEBAR_ENABLED
      when: never
    - !reference [.rules:test:qa, rules]

.rules:test:qa-default-branch:
  rules:
    - *qa-run-all-e2e-label
    - *default-branch
    - *feature-flags-set-manual

# ------------------------------------------
# Report
# ------------------------------------------
.rules:report:allure-report:
  rules:
    - if: $SKIP_ALLURE_REPORT == "true"
      when: never
    - when: always

.rules:report:process-results:
  rules:
    - <<: *not-canonical-project
      when: never
    - *process-test-results