global.gitlab-ci.yml 6.71 KB
Newer Older
Stan Hu's avatar
Stan Hu committed
1
2
3
4
5
.default-tags:
  tags:
    - gitlab-org

.default-retry:
Kamil Trzciński's avatar
Kamil Trzciński committed
6
  retry:
Kamil Trzciński's avatar
Kamil Trzciński committed
7
    max: 2  # This is confusing but this means "3 runs at max".
Kamil Trzciński's avatar
Kamil Trzciński committed
8
9
10
11
    when:
      - unknown_failure
      - api_failure
      - runner_system_failure
12
13
      - job_execution_timeout
      - stuck_or_timeout_failure
Kamil Trzciński's avatar
Kamil Trzciński committed
14

Stan Hu's avatar
Stan Hu committed
15
16
17
.default-before_script:
  before_script:
    - date
18
    - '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb'
19
20
    - export GOPATH=$CI_PROJECT_DIR/.go
    - mkdir -p $GOPATH
Stan Hu's avatar
Stan Hu committed
21
22
23
    - source scripts/utils.sh
    - source scripts/prepare_build.sh
    - date
Kamil Trzciński's avatar
Kamil Trzciński committed
24
25

# Jobs that only need to pull cache
Stan Hu's avatar
Stan Hu committed
26
.default-cache:
Kamil Trzciński's avatar
Kamil Trzciński committed
27
  cache:
28
    key: "debian-stretch-ruby-2.6.5-pg9.6-node-12.x"
Stan Hu's avatar
Stan Hu committed
29
    paths:
30
      - .go/pkg/mod
Stan Hu's avatar
Stan Hu committed
31
32
33
      - vendor/ruby
      - .yarn-cache/
      - vendor/gitaly-ruby
Kamil Trzciński's avatar
Kamil Trzciński committed
34
35
    policy: pull

36
37
.default-only:
  only:
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
38
    refs:
39
40
41
      - master
      - /^[\d-]+-stable(-ee)?$/
      - /^\d+-\d+-auto-deploy-\d+$/
42
      - /^security\//
43
44
      - merge_requests
      - tags
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
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
.only:variables-canonical-dot-com:
  only:
    variables:
      - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/  # Matches the gitlab-org group or its subgroups

.only:variables_refs-canonical-dot-com-schedules:
  extends: .only:variables-canonical-dot-com
  only:
    refs:
      - schedules

.except:refs-deploy:
  except:
    refs:
      - /^\d+-\d+-auto-deploy-\d+$/

.except:refs-master-tags-stable-deploy:
  except:
    refs:
      - master
      - tags
      - /^[\d-]+-stable(-ee)?$/
      - /^\d+-\d+-auto-deploy-\d+$/

.only:kubernetes:
  only:
    kubernetes: active

.only-review:
  extends:
    - .only:variables-canonical-dot-com
    - .only:kubernetes
    - .except:refs-master-tags-stable-deploy

.only-review-schedules:
  extends:
    - .only:variables_refs-canonical-dot-com-schedules
    - .only:kubernetes
    - .except:refs-deploy

86
87
88
89
90
91
92
93
94
95
96
97
98
.code-patterns: &code-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}/**/*"
99
  - "doc/api/graphql/reference/*" # Files in this folder are auto-generated
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

.backstage-patterns: &backstage-patterns
  - "Dangerfile"
  - "danger/**/*"
  - "{,ee/}fixtures/**/*"
  - "{,ee/}rubocop/**/*"
  - "{,ee/}spec/**/*"
  - "doc/README.md"  # Some RSpec test rely on this file

.qa-patterns: &qa-patterns
  - ".dockerignore"
  - "qa/**/*"

.docs-patterns: &docs-patterns
  - ".gitlab/route-map.yml"
  - "doc/**/*"
  - ".markdownlint.json"

.only:changes-code:
  only:
    changes: *code-patterns

.only:changes-qa:
  only:
    changes: *qa-patterns

.only:changes-docs:
  only:
    changes: *docs-patterns

.only:changes-code-backstage:
131
132
133
134
135
136
137
138
139
140
141
142
143
  only:
    changes:
      - ".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}"
144
      - "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
145
      - "doc/api/graphql/reference/*" # Files in this folder are auto-generated
146
147
148
149
150
151
      # Backstage changes
      - "Dangerfile"
      - "danger/**/*"
      - "{,ee/}fixtures/**/*"
      - "{,ee/}rubocop/**/*"
      - "{,ee/}spec/**/*"
152
      - "doc/README.md"  # Some RSpec test rely on this file
Kamil Trzciński's avatar
Kamil Trzciński committed
153

154
.only:changes-code-qa:
155
156
  only:
    changes:
157
158
159
160
161
162
163
164
165
166
167
168
      - ".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}/**/*"
169
      - "doc/api/graphql/reference/*" # Files in this folder are auto-generated
170
      # QA changes
171
172
      - ".dockerignore"
      - "qa/**/*"
173

174
.only:changes-code-backstage-qa:
175
  only:
176
177
178
179
180
181
182
183
184
185
186
187
    changes:
      - ".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}"
188
      - "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
189
      - "doc/api/graphql/reference/*" # Files in this folder are auto-generated
190
191
192
193
194
195
      # Backstage changes
      - "Dangerfile"
      - "danger/**/*"
      - "{,ee/}fixtures/**/*"
      - "{,ee/}rubocop/**/*"
      - "{,ee/}spec/**/*"
196
      - "doc/README.md"  # Some RSpec test rely on this file
197
      # QA changes
198
199
200
      - ".dockerignore"
      - "qa/**/*"

201
.use-pg9:
Stan Hu's avatar
Stan Hu committed
202
  services:
203
    - name: postgres:9.6
Stan Hu's avatar
Stan Hu committed
204
205
206
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine

207
.use-pg10:
208
  image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
Stan Hu's avatar
Stan Hu committed
209
210
211
212
  services:
    - name: postgres:10.9
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine
213

214
215
216
217
218
.use-pg9-ee:
  services:
    - name: postgres:9.6
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine
219
    - name: elasticsearch:6.4.2
220
221

.use-pg10-ee:
222
  image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
223
224
225
226
  services:
    - name: postgres:10.9
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine
227
    - name: elasticsearch:6.4.2
228

229
230
231
.only-ee:
  only:
    variables:
232
      - $CI_PROJECT_NAME == "gitlab"
233
      - $CI_PROJECT_NAME == "gitlab-ee"  # Support former project name for forks/mirrors
234

235
.as-if-foss:
236
  variables:
237
    FOSS_ONLY: '1'
238
239
240
241
242

.only-ee-as-if-foss:
  extends:
    - .only-ee
    - .as-if-foss