1 # see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
5 # images: Build the images with the bootstrap script
6 # build_first: Build a few things first to find silly errors (fast job)
7 # (don't pay for 35 machines until something compiles)
8 # build: The main parallel job
9 # (keep these to 1hour as we are billed per hour)
10 # test_only: Tests using the build from prior stages, these typically
11 # have an explicit dependency defined to a specific build job,
12 # which means that start as soon as the build job finished.
13 # test_private: Like test_only, but running on private runners
14 # report: Code coverage reporting
25 # We want to be resilient to runner failures
26 ARTIFACT_DOWNLOAD_ATTEMPTS: "3"
27 EXECUTOR_JOB_SECTION_ATTEMPTS: "3"
28 GET_SOURCES_ATTEMPTS: "3"
29 RESTORE_CACHE_ATTEMPTS: "3"
34 # we run autobuild.py inside a samba CI docker image located on gitlab's registry
35 # overwrite this variable if you want use your own image registry.
37 # Or better ask for access to the shared development repository, see
38 # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
40 SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
42 # Set this to the contents of bootstrap/sha1sum.txt
43 # which is generated by bootstrap/template.py --render
45 SAMBA_CI_CONTAINER_TAG: d849801e805f8772b78251d07a28eb332c24660
47 # We use the ubuntu1804 image as default as
48 # it matches what we have on sn-devel-184.
50 SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
52 # The following images are available
53 # Please see the samba-o3 sections at the end of this file!
54 # We should run that for each available image
56 SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ubuntu1804
57 SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ubuntu2004
58 SAMBA_CI_CONTAINER_IMAGE_debian9: debian9
59 SAMBA_CI_CONTAINER_IMAGE_debian10: debian10
60 SAMBA_CI_CONTAINER_IMAGE_debian11: debian11
61 SAMBA_CI_CONTAINER_IMAGE_opensuse153: opensuse153
62 SAMBA_CI_CONTAINER_IMAGE_fedora35: fedora35
63 SAMBA_CI_CONTAINER_IMAGE_f35mit120: f35mit120
64 SAMBA_CI_CONTAINER_IMAGE_centos7: centos7
65 SAMBA_CI_CONTAINER_IMAGE_centos8s: centos8s
68 # The image creation details are specified in a separate file
69 # See bootstrap/README.md for details
70 - 'bootstrap/.gitlab-ci.yml'
72 .shared_runner_build_image:
73 extends: .shared_runner_build
75 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE}
76 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_JOB_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
79 extends: .shared_runner_build_image
80 # All Samba jobs are interruptible, this avoids burning CPU when a
81 # newer branch is pushed.
85 # Otherwise we run twice, once on push and once on MR
86 # https://forum.gitlab.com/t/new-rules-syntax-and-detached-pipelines/37292
88 - if: $CI_MERGE_REQUEST_ID
93 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
96 key: ccache.${CI_JOB_NAME}.${SAMBA_CI_JOB_IMAGE}.${SAMBA_CI_FLAVOR}
100 # This is overridden in many cases, but ensures none of the other
101 # main jobs start until and unless this build finishes. However
102 # this also ensures we do not download artifacts from any build
103 # unless we specifically depend on it, saving bandwidth
106 - job: samba-def-build
112 - cat /etc/os-release
119 # ld will fail if coverage enabled, force link ld to ld.bfd
120 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
121 # See bootstrap/.gitlab-ci.yml how to generate a new image
122 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
123 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
124 - echo "SAMBA_CI_JOB_IMAGE[${SAMBA_CI_JOB_IMAGE}]"
125 - echo "CI_JOB_IMAGE[${CI_JOB_IMAGE}]"
126 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
127 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
128 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
129 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
130 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
131 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
132 - export CCACHE_BASEDIR="${PWD}"
133 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
134 - export CC="ccache cc"
135 - export CXX="ccache c++"
143 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
155 - runner_system_failure
156 - stuck_or_timeout_failure
162 - data_integrity_failure
165 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
166 # autobuild name, which means we can define a default template that runs most autobuild jobs
167 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
169 # Ensure when adding a new job below that you also add it to
170 # the dependencies for 'pages' below for the code coverage page
174 extends: .shared_template
176 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
177 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
178 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
179 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
180 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
181 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
182 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
183 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
185 .shared_template_build_only:
186 extends: .shared_template
196 - samba-testbase.tar.gz
198 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
199 # autobuild name, which means we can define a default template that runs most autobuild jobs
200 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
201 # On success we need to pack everything into an artifacts file
202 # which needs to be in the git checkout.
203 # As tar doesn't handle hardlink of read-only files,
204 # we remember the acls and add write permissions
205 # before creating the archive. The consumer will apply
207 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
208 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
209 - ln -s /tmp/samba-testbase/${AUTOBUILD_JOB_NAME}/ /tmp/samba-testbase/build_subdir_link
210 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
211 - chmod -R +w /tmp/samba-testbase
212 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
213 - tar cfz samba-testbase.tar.gz /tmp/samba-testbase
214 - ls -la samba-testbase.tar.gz
215 - sha1sum samba-testbase.tar.gz
217 .shared_template_test_only:
220 - .shared_runner_test
223 # Print the Kerberos version to check we ended up with the right one
224 # in the runner. We do not have configure output to recognize it
226 - if [ -x "$(command -v krb5-config)" ]; then krb5-config --version; fi
227 # We unpack the artifacts file created by the .shared_template_build_only
229 - ls -la samba-testbase.tar.gz
230 - sha1sum samba-testbase.tar.gz
231 - tar xfz samba-testbase.tar.gz -C /
232 - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
233 - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
234 - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
235 - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
236 - ls -la /tmp/samba-testbase/
237 - ls -la /tmp/samba-testbase/build_subdir_link
238 - ls -la /tmp/samba-testbase/build_subdir_link/
239 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then find /tmp/samba-testbase/build_subdir_link/ -type d -printf "'%p'\n" | xargs chmod u+w; fi
240 - ls -la /tmp/samba-testbase/build_subdir_link/
241 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
242 # autobuild name, which means we can define a default template that runs most autobuild jobs
243 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
246 extends: .shared_template_build_only
249 .needs_samba-def-build:
250 extends: .shared_template_test_only
252 - job: samba-def-build
256 extends: .shared_template_build_only
258 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora35}
262 extends: .shared_template_build_only
264 AUTOBUILD_JOB_NAME: samba-mit-build
265 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_f35mit120}
268 .needs_samba-mit-build:
269 extends: .shared_template_test_only
271 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora35}
273 - job: samba-mit-build
276 .needs_samba-mit120-build:
277 extends: .shared_template_test_only
279 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_f35mit120}
281 - job: samba-mit120-build
285 extends: .shared_template_build_only
287 .needs_samba-h5l-build:
288 extends: .shared_template_test_only
290 - job: samba-h5l-build
294 extends: .shared_template_build_only
296 .needs_samba-nt4-build:
297 extends: .shared_template_test_only
299 - job: samba-nt4-build
302 samba-no-opath-build:
303 extends: .shared_template_build_only
305 .needs_samba-no-opath-build:
306 extends: .shared_template_test_only
308 - job: samba-no-opath-build
312 extends: .shared_template
315 extends: .shared_template
317 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora35}
320 extends: .shared_template
323 extends: .shared_template
326 extends: .needs_samba-def-build
329 extends: .needs_samba-def-build
332 extends: .needs_samba-def-build
335 extends: .needs_samba-def-build
338 extends: .needs_samba-def-build
341 extends: .needs_samba-def-build
344 extends: .needs_samba-def-build
347 extends: .needs_samba-def-build
350 extends: .needs_samba-def-build
353 extends: .needs_samba-def-build
356 extends: .shared_template
359 extends: .shared_template
361 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
364 extends: .shared_template
367 extends: .shared_template
370 extends: .needs_samba-def-build
373 extends: .needs_samba-mit-build
376 extends: .needs_samba-mit-build
379 extends: .needs_samba-mit-build
381 # This task is run first to ensure we compile before we start the
382 # main run as it is the fastest full compile of Samba.
384 extends: .shared_template
386 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora35}
389 extends: .private_runner_test
392 # See above, to avoid a duplicate CI on the MR (these rules override the others)
393 - if: $CI_MERGE_REQUEST_ID
396 # These jobs are only run if the gitlab repo has private runners available.
397 # To enable private jobs, you must add the following var and value to
398 # your gitlab repo by navigating to:
399 # settings -> CI/CD -> Environment variables
400 - if: $SUPPORT_PRIVATE_TEST == "yes"
402 .needs_samba-def-build-private:
404 - .needs_samba-def-build
407 .needs_samba-mit-build-private:
409 - .needs_samba-mit-build
412 .needs_samba-mit120-build-private:
414 - .needs_samba-mit120-build
417 .needs_samba-h5l-build-private:
419 - .needs_samba-h5l-build
422 .needs_samba-nt4-build-private:
424 - .needs_samba-nt4-build
427 .needs_samba-no-opath-build-private:
429 - .needs_samba-no-opath-build
433 extends: .needs_samba-h5l-build-private
435 # This is a full build without the AD DC so we test the build with MIT
436 # Kerberos from the default system (Ubuntu 18.04 at this stage).
437 # Runtime behaviour checked via the ktest (static ccache and keytab)
440 extends: .shared_template
443 extends: .needs_samba-def-build-private
446 extends: .needs_samba-nt4-build-private
449 extends: .needs_samba-mit-build-private
452 extends: .needs_samba-mit120-build-private
454 AUTOBUILD_JOB_NAME: samba-addc-mit-1
457 extends: .needs_samba-no-opath-build-private
460 extends: .needs_samba-no-opath-build-private
462 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
464 extends: .shared_runner_build_image
466 dependencies: # tell gitlab to download artifacts for these jobs
492 - samba-schemaupgrade
497 - ubuntu1804-samba-o3
500 - ./configure.developer
503 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
505 - genhtml all.info --ignore-errors source --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
512 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
516 extends: .shared_runner_build_image
518 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
521 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
522 - tar xf /tmp/coverity_tool.tgz
523 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
524 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
525 - tar czf cov-int.tar.gz cov-int
527 --form token=$COVERITY_SCAN_TOKEN
528 --form email=$COVERITY_SCAN_EMAIL
529 --form file=@cov-int.tar.gz
530 --form version="`git describe --tags`"
531 --form description="CI build"
532 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
538 - $COVERITY_SCAN_TOKEN != null
539 - $COVERITY_SCAN_PROJECT_NAME != null
540 - $COVERITY_SCAN_EMAIL != null
548 # We build samba-o3 on all supported distributions
551 # This job, which matches the main CI, needs to still do coverage so
552 # we show the coverage on the "none" environment tests
554 # We want --enable-coverage specified here otherwise we will have a
555 # different set of build options on the coverage build and can fail
556 # when -O3 gets combined with --enable-coverage in the scheduled
560 extends: .shared_template
562 AUTOBUILD_JOB_NAME: samba-o3
563 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804}
564 SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: "--enable-coverage"
566 # See above, to avoid a duplicate CI on the MR (these rules override the others)
567 - if: $CI_MERGE_REQUEST_ID
569 # do not run o3 builds (which run a lot of VMs) if told not to
570 # (this uses the same variable as autobuild.py)
571 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
574 # All other jobs do not want code coverage.
576 extends: .shared_template
578 AUTOBUILD_JOB_NAME: samba-o3
580 # See above, to avoid a duplicate CI on the MR (these rules override the others)
581 - if: $CI_MERGE_REQUEST_ID
583 # do not run o3 builds (which run a lot of VMs) if told not to
584 # (this uses the same variable as autobuild.py)
585 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
587 # do not run o3 for coverage since they are using different images
588 - if: $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
591 extends: .samba-o3-template
593 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
596 extends: .samba-o3-template
598 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_debian10}
601 extends: .samba-o3-template
603 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_debian11}
605 opensuse153-samba-o3:
606 extends: .samba-o3-template
608 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse153}
611 extends: .samba-o3-template
613 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos7}
614 # Git on CentOS doesn't support shallow git cloning
616 # We need a newer GnuTLS version on CentOS7
617 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls37/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
620 extends: .samba-o3-template
622 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos8s}
625 extends: .samba-o3-template
627 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora35}
630 # Keep the samba-o3 sections at the end ...