forked from advancedtelematic/aktualizr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
404 lines (365 loc) · 11.6 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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
stages:
- docker
- test
- pkg-test
- oe-checkout
- oe-test
- deploy
- trigger
variables:
UBUNTU_BIONIC_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-master-UBUNTU_BIONIC
UBUNTU_XENIAL_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-master-UBUNTU_XENIAL
DEBIAN_TESTING_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-master-DEBIAN_TESTING
UBUNTU_BIONIC_MASTER_INSTALLIMAGE: ${CI_REGISTRY_IMAGE}:ci-install-master-UBUNTU_BIONIC
UBUNTU_XENIAL_MASTER_INSTALLIMAGE: ${CI_REGISTRY_IMAGE}:ci-install-master-UBUNTU_XENIAL
UBUNTU_BIONIC_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-UBUNTU_BIONIC
UBUNTU_XENIAL_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-UBUNTU_XENIAL
DEBIAN_TESTING_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-DEBIAN_TESTING
UBUNTU_BIONIC_PR_INSTALLIMAGE: ${CI_REGISTRY_IMAGE}:ci-install-${CI_COMMIT_REF_SLUG}-UBUNTU_BIONIC
UBUNTU_XENIAL_PR_INSTALLIMAGE: ${CI_REGISTRY_IMAGE}:ci-install-${CI_COMMIT_REF_SLUG}-UBUNTU_XENIAL
CCACHE_DIR: $CI_PROJECT_DIR/ccache
GIT_SUBMODULE_STRATEGY: recursive
# bitbake variables
BITBAKE_IMAGE: ${METAUPDATER_REGISTRY_IMAGE}:ci-master-bitbake
BITBAKE_CHECKOUT_IMAGE: ${METAUPDATER_REGISTRY_IMAGE}:ci-master-checkout
include:
- project: 'olp/edge/ota/connect/client/meta-updater'
ref: 'master'
file: 'scripts/ci/gitlab/docker.yml'
- project: 'olp/edge/ota/connect/client/meta-updater'
ref: 'master'
file: 'scripts/ci/gitlab/checkout.yml'
- project: 'olp/edge/ota/connect/client/meta-updater'
ref: 'master'
file: 'scripts/ci/gitlab/tests.yml'
Docker Setup:
image: docker:18
stage: docker
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
services:
- docker:18-dind
before_script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
script:
# main images
- docker pull "$UBUNTU_BIONIC_PR_IMAGE" || docker pull "$UBUNTU_BIONIC_MASTER_IMAGE" || true
- docker build --pull --cache-from "$UBUNTU_BIONIC_MASTER_IMAGE" --cache-from "$UBUNTU_BIONIC_PR_IMAGE" -f "$CI_PROJECT_DIR/docker/Dockerfile.ubuntu.bionic" -t "$UBUNTU_BIONIC_PR_IMAGE" .
- docker push "$UBUNTU_BIONIC_PR_IMAGE"
- docker pull "$UBUNTU_XENIAL_PR_IMAGE" || docker pull "$UBUNTU_XENIAL_MASTER_IMAGE" || true
- docker build --pull --cache-from "$UBUNTU_XENIAL_MASTER_IMAGE" --cache-from "$UBUNTU_XENIAL_PR_IMAGE" -f "$CI_PROJECT_DIR/docker/Dockerfile.ubuntu.xenial" -t "$UBUNTU_XENIAL_PR_IMAGE" .
- docker push "$UBUNTU_XENIAL_PR_IMAGE"
- docker pull "$DEBIAN_TESTING_PR_IMAGE" || docker pull "$DEBIAN_TESTING_MASTER_IMAGE" || true
- docker build --pull --cache-from "$DEBIAN_TESTING_MASTER_IMAGE" --cache-from "$DEBIAN_TESTING_PR_IMAGE" -f "$CI_PROJECT_DIR/docker/Dockerfile.debian.testing" -t "$DEBIAN_TESTING_PR_IMAGE" .
- docker push "$DEBIAN_TESTING_PR_IMAGE"
# used for install tests
- docker pull "$UBUNTU_BIONIC_PR_INSTALLIMAGE" || docker pull "$UBUNTU_BIONIC_MASTER_INSTALLIMAGE" || true
- docker build --pull --cache-from "$UBUNTU_BIONIC_MASTER_INSTALLIMAGE" --cache-from "$UBUNTU_BIONIC_PR_INSTALLIMAGE" -f "$CI_PROJECT_DIR/docker/Dockerfile-test-install.ubuntu.bionic" -t "$UBUNTU_BIONIC_PR_INSTALLIMAGE" .
- docker push "$UBUNTU_BIONIC_PR_INSTALLIMAGE"
- docker pull "$UBUNTU_XENIAL_PR_INSTALLIMAGE" || docker pull "$UBUNTU_XENIAL_MASTER_INSTALLIMAGE" || true
- docker build --pull --cache-from "$UBUNTU_XENIAL_MASTER_INSTALLIMAGE" --cache-from "$UBUNTU_XENIAL_PR_INSTALLIMAGE" -f "$CI_PROJECT_DIR/docker/Dockerfile-test-install.ubuntu.xenial" -t "$UBUNTU_XENIAL_PR_INSTALLIMAGE" .
- docker push "$UBUNTU_XENIAL_PR_INSTALLIMAGE"
coverage:
variables:
TEST_BUILD_DIR: 'build-coverage'
TEST_CMAKE_BUILD_TYPE: 'Valgrind'
TEST_WITH_COVERAGE: '1'
TEST_WITH_P11: '1'
TEST_WITH_DOCKERAPP: '1'
TEST_WITH_FAULT_INJECTION: '1'
TEST_SOTA_PACKED_CREDENTIALS: "$CI_PROJECT_DIR/credentials.zip"
image: "$UBUNTU_BIONIC_PR_IMAGE"
stage: test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
cache:
key: "$CI_JOB_NAME"
paths:
- ccache/
artifacts:
paths:
- build-coverage/coverage/
script:
- aws s3 cp s3://ota-gitlab-ci/hereotaconnect_prod.zip $CI_PROJECT_DIR/credentials.zip
- ./scripts/test.sh
nop11:
variables:
TEST_BUILD_DIR: 'build-nop11'
TEST_CMAKE_BUILD_TYPE: 'Debug'
TEST_WITH_TESTSUITE: '0'
image: "$UBUNTU_BIONIC_PR_IMAGE"
stage: test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
cache:
key: "$CI_JOB_NAME"
paths:
- ccache/
script:
- ./scripts/test.sh
debian-build+static:
variables:
TEST_BUILD_DIR: 'build-debian-testing'
TEST_CC: 'clang'
# should run with valgrind but some leaks are still unfixed
# TEST_CMAKE_BUILD_TYPE = 'Valgrind'
TEST_CMAKE_BUILD_TYPE: 'Debug'
TEST_TESTSUITE_ONLY: 'crypto'
TEST_WITH_STATICTESTS: '1'
TEST_WITH_LOAD_TESTS: '1'
TEST_WITH_DOCS: '1'
image: "$DEBIAN_TESTING_PR_IMAGE"
stage: test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
cache:
key: "$CI_JOB_NAME"
paths:
- ccache/
artifacts:
paths:
- build-debian-testing/docs/doxygen/
script:
- ./scripts/test.sh
bionic-pkg:
variables:
TEST_BUILD_DIR: 'build-bionic'
TEST_INSTALL_RELEASE_NAME: '-ubuntu_18.04'
TEST_INSTALL_DESTDIR: "$CI_PROJECT_DIR/build-bionic/pkg"
image: "$UBUNTU_BIONIC_PR_IMAGE"
stage: test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
cache:
key: "$CI_JOB_NAME"
paths:
- ccache/
artifacts:
paths:
- build-bionic/pkg
script:
- mkdir -p $TEST_INSTALL_DESTDIR
- ./scripts/build_ubuntu.sh
xenial-pkg:
variables:
TEST_BUILD_DIR: 'build-xenial'
TEST_INSTALL_RELEASE_NAME: '-ubuntu_16.04'
TEST_INSTALL_DESTDIR: "$CI_PROJECT_DIR/build-xenial/pkg"
image: "$UBUNTU_XENIAL_PR_IMAGE"
stage: test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
cache:
key: "$CI_JOB_NAME"
paths:
- ccache/
artifacts:
paths:
- build-xenial/pkg
script:
- mkdir -p $TEST_INSTALL_DESTDIR
- ./scripts/build_ubuntu.sh
bionic-pkg-test:
variables:
TEST_INSTALL_DESTDIR: "$CI_PROJECT_DIR/build-bionic/pkg"
image: "$UBUNTU_BIONIC_PR_INSTALLIMAGE"
dependencies:
- bionic-pkg
stage: pkg-test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
script:
- ./scripts/test_install_garage_deploy.sh
- ./scripts/test_install_aktualizr.sh
xenial-pkg-test:
variables:
TEST_INSTALL_DESTDIR: "$CI_PROJECT_DIR/build-xenial/pkg"
image: "$UBUNTU_XENIAL_PR_INSTALLIMAGE"
dependencies:
- xenial-pkg
stage: pkg-test
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
script:
- ./scripts/test_install_garage_deploy.sh
- ./scripts/test_install_aktualizr.sh
# -- yocto tests
OE Docker setup:
extends: .bb_docker_remote
stage: docker
only:
variables:
- $OE_PTEST
- $CI_COMMIT_REF_NAME == "master"
- $CI_COMMIT_REF_NAME =~ /^\d\d\d\d\.\d+(-\w+)?$/
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
OE Checkout:
extends: .bb_checkout
stage: oe-checkout
dependencies: []
only:
variables:
- $OE_PTEST
- $CI_COMMIT_REF_NAME == "master"
- $CI_COMMIT_REF_NAME =~ /^\d\d\d\d\.\d+(-\w+)?$/
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
variables:
MANIFEST: master
Ptest qemux86_64:
extends: .oe-selftest
stage: oe-test
dependencies:
- OE Checkout
allow_failure: true
only:
variables:
- $OE_PTEST
- $CI_COMMIT_REF_NAME == "master"
- $CI_COMMIT_REF_NAME =~ /^\d\d\d\d\.\d+(-\w+)?$/
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
variables:
TEST_BUILD_DIR: 'build-ptest'
OE_SELFTESTS: 'updater_qemux86_64_ptest'
TEST_AKTUALIZR_REMOTE: '1'
# note: tag will take precedence if not empty
TEST_AKTUALIZR_TAG: $CI_COMMIT_TAG
TEST_AKTUALIZR_BRANCH: $CI_COMMIT_REF_NAME
TEST_AKTUALIZR_REV: $CI_COMMIT_SHA
# -- create GitHub releases
github-release:
image: "$UBUNTU_BIONIC_PR_IMAGE"
stage: deploy
dependencies:
- bionic-pkg
- xenial-pkg
- debian-build+static # for doxygen
script:
# github release
- ./scripts/make_src_archive.sh ./aktualizr_src-$CI_COMMIT_TAG.tar.gz
- >-
./scripts/publish_github_rls.py $CI_COMMIT_TAG
build-xenial/pkg/garage_deploy-ubuntu_16.04.deb
build-xenial/pkg/aktualizr-ubuntu_16.04.deb
build-bionic/pkg/garage_deploy-ubuntu_18.04.deb
build-bionic/pkg/aktualizr-ubuntu_18.04.deb
aktualizr_src-$CI_COMMIT_TAG.tar.gz
# github doxygen
- ./scripts/publish_github_docs.sh
only:
variables:
- $CI_COMMIT_TAG =~ /^\d\d\d\d\.\d+(-\w+)?$/
except:
- /^20\d\d\.\d\d?-docs$/
variables:
DOX_DOCS: 'build-debian-testing/docs/doxygen/html'
TEST_BUILD_DIR: 'build-gh-rls'
# -- publish coverage results on gitlab pages
pages:
stage: deploy
dependencies:
- coverage
script:
- mv build-coverage/coverage/ public/
artifacts:
paths:
- public
expire_in: 7 days
# would be nice to have on a per-PR basis: # https://gitlab.com/gitlab-org/gitlab-ce/issues/35141
only:
- master
# -- veracode
veracode-pkg:
# prepare build to be submitted for static code analysis
stage: test
only:
variables:
- $VERACODE_API_ID
variables:
TEST_BUILD_DIR: 'scan-build'
TEST_CMAKE_BUILD_TYPE: 'Debug'
TEST_WITH_TESTSUITE: '0'
TEST_WITH_SOTA_TOOLS: '0'
TEST_WITH_OSTREE: '0'
TEST_WITH_DEB: '0'
TEST_WITH_ISOTP: '0'
image: "$UBUNTU_BIONIC_PR_IMAGE"
script:
- ./scripts/test.sh
- tar -f scan.tar --append /tmp/aktualizr/usr/local/bin
artifacts:
paths:
- scan.tar
trigger-veracode-scan:
stage: trigger
only:
variables:
- $VERACODE_API_ID
dependencies:
- veracode-pkg
allow_failure: true
image: openjdk:8
before_script:
# The latest wrapper version can be found in https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/
- wget -q -O veracode-wrapper.jar https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/${VERACODE_WRAPPER_VERSION}/vosp-api-wrappers-java-${VERACODE_WRAPPER_VERSION}.jar
script:
- java -jar veracode-wrapper.jar -vid ${VERACODE_API_ID} -vkey ${VERACODE_API_KEY}
-action UploadAndScan -appname "OTA Client" -createprofile true -autoscan true
-filepath scan.tar -version "job ${CI_JOB_ID} in pipeline ${CI_PIPELINE_ID} for ${CI_PROJECT_NAME} repo"
# -- e2e
app-docker-image:
image: docker:18
services:
- docker:18-dind
stage: deploy
only:
- master
dependencies: []
allow_failure: true
before_script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
script:
- sed 's@$BUILDER@'$UBUNTU_BIONIC_MASTER_IMAGE'@' ./ci/gitlab/Dockerfile.aktualizr > ./ci/gitlab/Dockerfile
- docker build -t $CI_REGISTRY_IMAGE/app:ci-$CI_COMMIT_REF_SLUG -f ./ci/gitlab/Dockerfile .
- docker push $CI_REGISTRY_IMAGE/app:ci-$CI_COMMIT_REF_SLUG
trigger-e2e-pipeline:
stage: trigger
only:
- master
trigger: olp/edge/ota/testing/ota-plus-test-driver
# -- otf
trigger-otf-pipeline:
image: "$UBUNTU_BIONIC_PR_IMAGE"
stage: trigger
when: on_success
dependencies:
- github-release
script:
- curl -X POST -F "token=$CI_JOB_TOKEN" -F "ref=master" -F "variables[TEST_JOB_ONLY]=true" https://main.gitlab.in.here.com/api/v4/projects/163/trigger/pipeline
only:
variables:
- $CI_COMMIT_REF_NAME =~ /^\d\d\d\d\.\d+(-\w+)?$/
except:
- /^20\d\d\.\d\d?-docs$/
- /^docs\//
allow_failure: true
trigger-docsite-build:
stage: trigger
only:
- /^20\d\d\.\d\d?-docs$/
trigger:
project: olp/edge/ota/documentation/ota-connect-docs
branch: master