-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
278 lines (243 loc) · 5.93 KB
/
.gitlab-ci.yml
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
stages:
- prepare
- prebuild
- test
- build
- package
- release
- cleanup
variables:
CI_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/ci:1.8-2
GOROOT: /usr/local/go
image: $CI_IMAGE
.docker: &docker
services:
- docker:dind
variables: &docker_variables
CI_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/ci:1.8-2
DOCKER_DRIVER: overlay
DOCKER_HOST: tcp://docker:2375
tags:
- docker
#
# Prepare stage
#
.image_builder: &image_builder
<<: *docker
stage: prepare
image: docker:git
script:
- source ./ci/build_ci_image
prepare ci image:
<<: *image_builder
variables:
BUILD_IMAGE: $CI_IMAGE
BUILD_DOCKERFILE: ./dockerfiles/ci/Dockerfile
only:
- /\Adocker-ci-image\/.*/
prepare alpine-no-root image:
<<: *image_builder
variables:
BUILD_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/alpine-no-root:latest
BUILD_DOCKERFILE: ./tests/dockerfiles/alpine-no-root/Dockerfile
only:
- /\Adocker-alpine-no-root-image\/.*/
#
# Prebuild stage
#
bindata:
<<: *docker
stage: prebuild
script:
- make docker
artifacts:
paths:
- out/docker/prebuilt-x86_64.tar.xz
- out/docker/prebuilt-arm.tar.xz
- executors/docker/bindata.go
- .gopath/bin
- .gopath/.ok
expire_in: 7d
clone test repo:
stage: prebuild
script:
- mkdir tmp
- succeed=0
- for i in {1..3}; do git clone https://gitlab.com/gitlab-org/gitlab-test.git tmp/gitlab-test && succeed=1 && break; echo "retrying"; done
- '[[ "$succeed" -eq 1 ]]'
artifacts:
paths:
- tmp/gitlab-test
expire_in: 7d
#
# Test stage
#
codequality:
stage: test
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
CODECLIMATE_FORMAT: json
cache: {}
dependencies: []
script:
- ./scripts/codequality analyze -f json --dev | tee codeclimate.json
artifacts:
paths: [codeclimate.json]
expire_in: 1 week
unit tests (no race):
<<: *docker
stage: test
script:
- source ci/touch_make_dependencies
- make test
unit tests:
<<: *docker
stage: test
allow_failure: true
script:
- source ci/touch_make_dependencies
- CGO_ENABLED=1 TESTFLAGS="-cover -race" make test
race conditions detector:
<<: *docker
stage: test
script:
- source ci/touch_make_dependencies
- make check_race_conditions
git 1.7.1:
image: centos:6
stage: test
variables:
GOROOT: /usr/local/go
GOPATH: /go
CGO_ENABLED: 0
OUR_PACKAGES: gitlab.com/gitlab-org/gitlab-runner/executors/shell gitlab.com/gitlab-org/gitlab-runner/shells
before_script:
- yum install -y -q git && git version
- curl https://storage.googleapis.com/golang/go1.8.5.linux-amd64.tar.gz | tar zx -C $(dirname "$GOROOT")
- export PATH=${GOROOT}/bin:$PATH
- source ci/touch_make_dependencies
script:
- make test
#
# Build stage
#
.binaries: &binaries
stage: build
script:
- source ci/touch_make_dependencies
- export platforms=$(echo $CI_JOB_NAME | sed 's|binaries ||')
- make build BUILD_PLATFORMS="-osarch='$platforms'"
artifacts:
paths:
- out/binaries/
expire_in: 7d
tags:
- docker
binaries darwin/386 darwin/amd64: *binaries
binaries freebsd/386 freebsd/amd64 freebsd/arm: *binaries
binaries linux/386 linux/amd64 linux/arm: *binaries
binaries windows/386 windows/amd64: *binaries
#
# Package stage
#
.packages: &packages
stage: package
script:
- mkdir -p out/docker
- touch out/docker/prebuilt-x86_64.tar.xz
- touch out/docker/prebuilt-arm.tar.xz
- touch executors/docker/bindata.go
- source ci/touch_make_dependencies
- make ${CI_JOB_NAME}
artifacts:
paths:
- out/deb/
- out/rpm/
expire_in: 7d
tags:
- docker
package-deb: *packages
package-rpm: *packages
#
# Release stage
#
.release_docker_images: &release_docker_images
<<: *docker
stage: release
variables: &release_docker_images_variables
<<: *docker_variables
CI_REGISTRY_IMAGE: "alloyci/alloy-runner"
PUBLISH_IMAGES: "true"
PUSH_TO_DOCKER_HUB: "true"
DOCKER_MACHINE_VERSION: "0.13.0"
DOCKER_MACHINE_CHECKSUM: "8f5310eb9e04e71b44c80c0ccebd8a85be56266b4170b4a6ac6223f7b5640df9"
DUMB_INIT_VERSION: "1.0.2"
DUMB_INIT_CHECKSUM: "a8defac40aaca2ca0896c7c5adbc241af60c7c3df470c1a4c469a860bd805429"
script:
- source ci/touch_make_dependencies
- make release_docker_images
tags:
- docker
.release: &release
stage: release
before_script:
- source ci/touch_make_dependencies
tags:
- docker
.release_s3: &release_s3
<<: *release
script:
- make release_s3
.release_packagecloud: &release_packagecloud
<<: *release
script:
- make release_packagecloud
.release_bleeding_edge: &release_bleeding_edge
only:
- master
.release_stable: &release_stable
only:
- /\Av[0-9]+\.[0-9]+\.[0-9]+\Z/
bleeding edge S3:
<<: *release_s3
<<: *release_bleeding_edge
environment:
name: bleeding_edge/s3
url: https://alloyci-runner-downloads.s3.amazonaws.com/${CI_COMMIT_REF_NAME}/index.html
bleeding edge packagecloud:
<<: *release_packagecloud
<<: *release_bleeding_edge
variables:
PACKAGE_CLOUD: alloyci/alloy-runner-unstable
environment:
name: bleeding_edge/packagecloud
url: https://packagecloud.io/alloyci/alloy-runner-unstable
bleeding edge docker images:
<<: *release_docker_images
<<: *release_bleeding_edge
environment:
name: bleeding_edge/docker_images
url: https://hub.docker.com/r/alloyci/alloy-runner/tags/
stable S3:
<<: *release_s3
<<: *release_stable
environment:
name: stable/s3
url: https://alloyci-runner-downloads.s3.amazonaws.com/${CI_COMMIT_REF_NAME}/index.html
stable packagecloud:
<<: *release_packagecloud
<<: *release_stable
variables:
PACKAGE_CLOUD: alloyci/alloy-runner
environment:
name: stable/packagecloud
url: https://packagecloud.io/alloyci/alloy-runner
stable docker images:
<<: *release_docker_images
<<: *release_stable
environment:
name: stable/docker_images
url: https://hub.docker.com/r/alloyci/alloy-runner/tags/