-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
260 lines (232 loc) · 10.2 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
variables:
GIT_DEPTH: 1000
go-api-version-build:
when: manual
stage: build
image: golang:1.20-bullseye
script:
- cd go-api-version/ && apt update && apt install -y upx-ucl && ./build.sh
artifacts:
when: on_success
paths:
- go-api-version/skip-if-tree-ok-in-past
.base-job:
stage: test
artifacts:
expire_in: 30 days
paths:
- result.txt
.ci-history-cache:
cache:
- key: "${CI_PROJECT_NAMESPACE}__${CI_PROJECT_NAME}__${CI_JOB_NAME}__ci_ok_history"
policy: pull-push
paths:
- ci_ok_history
########################################################################################################################
SERVICE-A-go-cache:
image: alpine
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml go-cache-version/skip-if-tree-ok-in-past
script:
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
SERVICE-B-go-cache:
image: alpine
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml go-cache-version/skip-if-tree-ok-in-past
script:
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time go-cache-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
########################################################################################################################
SERVICE-A-node-cache:
image: jersou/alpine-git-nodejs-unzip
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml node-cache-version/skip.js
script:
- time node-cache-version/skip.js || _example/service-A/test.sh
- time node-cache-version/skip.js || _example/service-A/test.sh
- time node-cache-version/skip.js || _example/service-A/test.sh
SERVICE-B-node-cache:
image: jersou/alpine-git-nodejs-unzip
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml node-cache-version/skip.js
script:
- time node-cache-version/skip.js || _example/service-B/test.sh
- time node-cache-version/skip.js || _example/service-B/test.sh
- time node-cache-version/skip.js || _example/service-B/test.sh
########################################################################################################################
SERVICE-A-bash-cache:
image: jersou/alpine-bash-curl-git-unzip
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml bash-cache-version/skip.sh
script:
- time bash-cache-version/skip.sh || _example/service-A/test.sh
- time bash-cache-version/skip.sh || _example/service-A/test.sh
- time bash-cache-version/skip.sh || _example/service-A/test.sh
SERVICE-B-bash-cache:
image: jersou/alpine-bash-curl-git-unzip
extends:
- .base-job
- .ci-history-cache
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml bash-cache-version/skip.sh
script:
- time bash-cache-version/skip.sh || _example/service-B/test.sh
- time bash-cache-version/skip.sh || _example/service-B/test.sh
- time bash-cache-version/skip.sh || _example/service-B/test.sh
########################################################################################################################
SERVICE-A-node-api:
image: jersou/alpine-bash-curl-fx-git-nodejs-unzip
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml node-api-version/skip.js
script:
- time node-api-version/skip.js || _example/service-A/test.sh
- time node-api-version/skip.js || _example/service-A/test.sh
- time node-api-version/skip.js || _example/service-A/test.sh
SERVICE-B-node-api:
image: jersou/alpine-bash-curl-fx-git-nodejs-unzip
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml node-api-version/skip.js
script:
- time node-api-version/skip.js || _example/service-B/test.sh
- time node-api-version/skip.js || _example/service-B/test.sh
- time node-api-version/skip.js || _example/service-B/test.sh
########################################################################################################################
SERVICE-A-go-api:
image: alpine
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml go-api-version/skip-if-tree-ok-in-past
script:
- time go-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time go-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time go-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
SERVICE-B-go-api:
image: alpine
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml go-api-version/skip-if-tree-ok-in-past
script:
- time go-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time go-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time go-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
########################################################################################################################
SERVICE-A-rust-api:
image: alpine
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml rust-api-version/skip-if-tree-ok-in-past
script:
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-A/test.sh
SERVICE-B-rust-api:
image: alpine
extends: .base-job
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml rust-api-version/skip-if-tree-ok-in-past
script:
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
SERVICE-C-rust-api:
image: alpine
extends: .base-job
variables:
SKIP_CI_VERBOSE: "true"
SKIP_IF_TREE_OK_IN_PAST: .gitlab-ci.yml rust-api-version
script:
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
- time rust-api-version/skip-if-tree-ok-in-past || _example/service-B/test.sh
########################################################################################################################
########################################################################################################################
########################################################################################################################
.base-job-go-before-script-allow-failure-skip:
stage: test
cache:
- key: "${CI_PROJECT_NAMESPACE}__${CI_PROJECT_NAME}__${CI_JOB_NAME}__ci_ok_history"
policy: pull-push
paths:
- ci_ok_history
allow_failure:
exit_codes:
- 222 # allow the 222 exit code : allow failure if tree is found in history
variables:
SKIP_CI_NO_ARTIFACT: "true"
before_script:
# skip the job if the SHA-1 of the "$SKIP_IF_TREE_OK_IN_PAST" tree is in the history file
- "! time go-cache-version/skip-if-tree-ok-in-past || exit 222"
SERVICE-A-go-skip-allow-failure:
image: alpine
extends: .base-job-go-before-script-allow-failure-skip
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml go-cache-version/skip-if-tree-ok-in-past
script:
- _example/service-A/test.sh
- _example/service-A/test.sh
- _example/service-A/test.sh
SERVICE-B-go-skip-allow-failure:
image: alpine
extends: .base-job-go-before-script-allow-failure-skip
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml go-cache-version/skip-if-tree-ok-in-past
script:
- _example/service-B/test.sh
- _example/service-B/test.sh
- _example/service-B/test.sh
########################################################################################################################
########################################################################################################################
########################################################################################################################
.base-job-bash-before-script-allow-failure-skip:
stage: test
cache:
- key: "${CI_PROJECT_NAMESPACE}__${CI_PROJECT_NAME}__${CI_JOB_NAME}__ci_ok_history"
policy: pull-push
paths:
- ci_ok_history
allow_failure:
exit_codes:
- 222 # allow the 222 exit code : allow failure if tree is found in history
variables:
SKIP_CI_NO_ARTIFACT: "true"
before_script:
# skip the job if the SHA-1 of the "$SKIP_IF_TREE_OK_IN_PAST" tree is in the history file
- "! time bash-cache-version/skip.sh || exit 222"
SERVICE-A-bash-skip-allow-failure:
image: jersou/alpine-bash-git-unzip
extends: .base-job-bash-before-script-allow-failure-skip
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-A _example/LIB-1/test.sh _example/LIB-2 .gitlab-ci.yml bash-cache-version/skip.sh
script:
- _example/service-A/test.sh
- _example/service-A/test.sh
- _example/service-A/test.sh
SERVICE-B-bash-skip-allow-failure:
image: jersou/alpine-bash-git-unzip
extends: .base-job-bash-before-script-allow-failure-skip
variables:
SKIP_IF_TREE_OK_IN_PAST: _example/service-B _example/LIB-2 .gitlab-ci.yml bash-cache-version/skip.sh
script:
- _example/service-B/test.sh
- _example/service-B/test.sh
- _example/service-B/test.sh