summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 9db4f561167b507896b1cb86d4307f2106f1e104 (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
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
variables:
  DEBIAN_FRONTEND: noninteractive
  LC_ALL: C
  GIT_STRATEGY: fetch
  DOCKER_DRIVER: overlay2
  GIT_SUBMODULE_STRATEGY: recursive
  DISTROTEST_PRIORITY: 6

stages:
  - image
  - build
  - test
  - documentation
  - deploy
  - deploy-test

.image: &image
  stage: image
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - docker build --no-cache -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
    - docker push "$IMAGE_TAG"
  tags:
    - dind
  only:
    variables:
      - $SCHEDULE_TYPE == "weekly"

docker:knot-dns:debian:
  <<: *image
  variables:
    IMAGE_NAME: debian:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:debian:unstable:
  <<: *image
  variables:
    IMAGE_NAME: debian:unstable
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:ubuntu:
  <<: *image
  variables:
    IMAGE_NAME: ubuntu:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:centos:
  <<: *image
  variables:
    IMAGE_NAME: centos:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:fedora:
  <<: *image
  variables:
    IMAGE_NAME: fedora:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

.fedora_latest: &fedora_latest
  image: "$CI_REGISTRY/knot/knot-dns/fedora:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules


.centos_latest: &centos_latest
  image: "$CI_REGISTRY/knot/knot-dns/centos:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.debian_stable: &debian_stable
  image: "$CI_REGISTRY/knot/knot-dns/debian:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.debian_unstable: &debian_unstable
  image: "$CI_REGISTRY/knot/knot-dns/debian:unstable"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.ubuntu_latest: &ubuntu_latest
  image: "$CI_REGISTRY/knot/knot-dns/ubuntu:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.build: &build_job
  stage: build
  script:
    - autoreconf -fi
    - ./configure --disable-fastparser $EXTRA_CONFIGURE || ( cat config.log && exit 1 )
    - make -k all V=1
  artifacts:
    untracked: true
    expire_in: '1 hour'
  except:
    - schedules

.test: &test_job
  stage: test
  script:
    - make -k check V=1
  except:
    - schedules

.pkg_symbols: &pkg_symbols
  stage: test
  script:
    - ln -s distro/deb debian
    - sed -i "s/__VERSION__/99/g" distro/deb/changelog
    - dpkg-gensymbols -c4 -esrc/.libs/$LIB_NAME.so.$LIB_ABI -P. -p$LIB_NAME$LIB_ABI
  allow_failure: true
  except:
  only:
    - schedules
  dependencies:
    - build:debian:amd64

build:fedora:amd64:
  <<: *fedora_latest
  <<: *build_job

test:fedora:amd64:
  <<: *fedora_latest
  <<: *test_job
  dependencies:
    - build:fedora:amd64

build:centos:amd64:
  <<: *centos_latest
  <<: *build_job

test:centos:amd64:
  <<: *centos_latest
  <<: *test_job
  dependencies:
    - build:centos:amd64

build:ubuntu:amd64:
  <<: *ubuntu_latest
  <<: *build_job

test:ubuntu:amd64:
  <<: *ubuntu_latest
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64

build:debian:amd64:
  variables:
    EXTRA_CONFIGURE: --enable-xdp=yes
  <<: *debian_stable
  <<: *build_job
  except:  # run on schedules as well, for debian:symbols tests

test:debian:amd64:
  <<: *debian_stable
  <<: *test_job
  dependencies:
    - build:debian:amd64

pkg:debian:symbols:libknot:
  variables:
    LIB_NAME: libknot
    LIB_ABI: 11
  <<: *debian_stable
  <<: *pkg_symbols

pkg:debian:symbols:libdnssec:
  variables:
    LIB_NAME: libdnssec
    LIB_ABI: 8
  <<: *debian_stable
  <<: *pkg_symbols

pkg:debian:symbols:libzscanner:
  variables:
    LIB_NAME: libzscanner
    LIB_ABI: 3
  <<: *debian_stable
  <<: *pkg_symbols

build:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64

build:debian:unstable:amd64:asan:
  variables:
    CC: clang-9
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
    LDFLAGS: "-fsanitize=address"
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-9/bin/llvm-symbolizer
    LSAN_OPTIONS: verbosity=1:log_threads=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
    CC: clang-9
    CFLAGS: "-fsanitize=address -g -O2"
    LDFLAGS: "-fsanitize=address"
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-9/bin/llvm-symbolizer
    LSAN_OPTIONS: verbosity=1:log_threads=1
  allow_failure: true
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:asan

build:debian:unstable:amd64:ubsan:
  variables:
    CC: clang-9
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
    LDFLAGS: "-fsanitize=undefined"
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-9/bin/llvm-symbolizer
    UBSAN_OPTIONS: print_stacktrace=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:ubsan:
  variables:
    CC: clang-9
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
    LDFLAGS: "-fsanitize=undefined"
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-9/bin/llvm-symbolizer
    UBSAN_OPTIONS: print_stacktrace=1
  allow_failure: true
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:ubsan

build:archive:
  <<: *debian_stable
  stage: build
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
    - make distcheck V=1
  only:
    - master
    - tags
    - triggers
    - schedules
  except: []
  artifacts:
    paths:
      - _build/*.tar.xz

obs:trigger:
  <<: *debian_stable
  stage: deploy
  only:
    variables:
      - $OBS_REPO
  except: []
  dependencies:
    - build:archive
  environment:
    name: OBS/$OBS_REPO
    url: https://build.opensuse.org/package/show/home:CZ-NIC:$OBS_REPO/knot
  tags:
    - respdiff
  script:
    - mv _build/*.tar.xz ./
    - scripts/make-distrofiles.sh
    - scripts/build-in-obs.sh $OBS_REPO

build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
  script:
    - make -C doc html singlehtml pdf epub V=1
  artifacts:
    paths:
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/KnotDNS.pdf
      - doc/_build/epub/KnotDNS.epub
    expire_in: '1 hour'

.deploytest: &deploytest
  stage: deploy-test
  only:
    variables:
      - $OBS_REPO =~ /^knot-dns-devel|knot-dns-latest|knot-dns-testing$/
  dependencies: []
  when: delayed
  start_in: 3 minutes  # give OBS build some time
  tags:
    - respdiff

obs:build:all:
  <<: *deploytest
  script:
    - "osc results home:CZ-NIC:$OBS_REPO knot -w"
    - version=$(sed 's/^v//' <(git describe --exact-match HEAD || git rev-parse --short HEAD) )
    - > # check version only for one (reliable) repo to avoid false negatives
      ! osc ls -b home:CZ-NIC:$OBS_REPO knot Debian_9.0 x86_64 | \
        grep -E '(rpm|deb|tar\.xz)$' | grep -v $version || \
        (echo "ERROR: version mismatch"; exit 1)
    - >
      ! osc results home:CZ-NIC:$OBS_REPO knot --csv | \
        grep -Ev 'disabled|excluded|Rawhide' | grep -v 'succeeded' -q || \
        (echo "ERROR: build(s) failed"; exit 1)

.distrotest: &distrotest
  <<: *deploytest
  script:
    - "osc results home:CZ-NIC:$OBS_REPO knot -a x86_64 -r $DISTROTEST_REPO -w"
    - >
      osc results home:CZ-NIC:$OBS_REPO knot -a x86_64 -r $DISTROTEST_REPO --csv | grep 'succeeded|$' -q || \
        (echo "ERROR: build failed"; exit 1)
    - export LABEL="gl$(date +%s)_$OBS_REPO"
    - export COMMITDIR="/var/tmp/respdiff-jobs/$(git rev-parse --short HEAD)-$LABEL"
    - export TESTDIR="$COMMITDIR/distrotest.$DISTROTEST_NAME"
    - ln -s $COMMITDIR distrotest_commitdir
    - sudo -u respdiff /var/opt/respdiff/contrib/job_manager/submit.py -w
      -p $DISTROTEST_PRIORITY
      $(sudo -u respdiff /var/opt/respdiff/contrib/job_manager/create.py
        "$(git rev-parse --short HEAD)" -l $LABEL -t distrotest.$DISTROTEST_NAME
        --package knot-dns --obs-repo $OBS_REPO)
    - export EXITCODE=$(cat $TESTDIR/j*_exitcode)
    - if [[ "$EXITCODE" != "0" ]]; then cat $TESTDIR/j*_{vagrant.log.txt,stdout.txt}; fi
    - exit $EXITCODE
  after_script:
    - 'cp -t . distrotest_commitdir/distrotest.$DISTROTEST_NAME/j* ||:'
  artifacts:
    when: always
    expire_in: 1 week
    paths:
      - ./j*

obs:centos7:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: centos7
    DISTROTEST_REPO: CentOS_7_EPEL

obs:centos8:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: centos8
    DISTROTEST_REPO: CentOS_8_EPEL

obs:debian9:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: debian9
    DISTROTEST_REPO: Debian_9.0

obs:debian10:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: debian10
    DISTROTEST_REPO: Debian_10

obs:fedora31:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: fedora31
    DISTROTEST_REPO: Fedora_31

obs:fedora32:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: fedora32
    DISTROTEST_REPO: Fedora_32

obs:leap15:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: leap15
    DISTROTEST_REPO: openSUSE_Leap_15.2

obs:ubuntu1604:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: ubuntu1604
    DISTROTEST_REPO: xUbuntu_16.04

obs:ubuntu1804:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: ubuntu1804
    DISTROTEST_REPO: xUbuntu_18.04

obs:ubuntu2004:x86_64:
  <<: *distrotest
  variables:
    DISTROTEST_NAME: ubuntu2004
    DISTROTEST_REPO: xUbuntu_20.04