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 # Use GZip by default, it is fast and is good enough. Other options include --xz
36 SAMBA_TESTBASE_TAR_OPTIONS: -z
39 # we run autobuild.py inside a samba CI docker image located on gitlab's registry
40 # overwrite this variable if you want use your own image registry.
42 # Or better ask for access to the shared development repository, see
43 # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
45 SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
47 # Set this to the contents of bootstrap/sha1sum.txt
48 # which is generated by bootstrap/template.py --render
50 SAMBA_CI_CONTAINER_TAG: 1e06877f1afbb3dbd4283e00310d63216a274333
52 # We use the ubuntu1804 image as default as
53 # it matches what we have on sn-devel-184.
55 SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
57 # The following images are available
58 # Please see the samba-o3 sections at the end of this file!
59 # We should run that for each available image
61 SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ubuntu1804
62 SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ubuntu2004
63 SAMBA_CI_CONTAINER_IMAGE_debian11: debian11
64 SAMBA_CI_CONTAINER_IMAGE_opensuse153: opensuse153
65 SAMBA_CI_CONTAINER_IMAGE_fedora36: fedora36
66 SAMBA_CI_CONTAINER_IMAGE_f36mit120: f36mit120
67 SAMBA_CI_CONTAINER_IMAGE_centos7: centos7
68 SAMBA_CI_CONTAINER_IMAGE_centos8s: centos8s
71 # The image creation details are specified in a separate file
72 # See bootstrap/README.md for details
73 - 'bootstrap/.gitlab-ci.yml'
75 .shared_runner_build_image:
76 extends: .shared_runner_build
78 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE}
79 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_JOB_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
82 extends: .shared_runner_build_image
83 # All Samba jobs are interruptible, this avoids burning CPU when a
84 # newer branch is pushed.
88 # Otherwise we run twice, once on push and once on MR
89 # https://forum.gitlab.com/t/new-rules-syntax-and-detached-pipelines/37292
91 - if: $CI_MERGE_REQUEST_ID
96 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
99 key: ccache.${CI_JOB_NAME}.${SAMBA_CI_JOB_IMAGE}.${SAMBA_CI_FLAVOR}
103 # This is overridden in many cases, but ensures none of the other
104 # main jobs start until and unless this build finishes. However
105 # this also ensures we do not download artifacts from any build
106 # unless we specifically depend on it, saving bandwidth
109 - job: samba-def-build
115 - cat /etc/os-release
122 # ld will fail if coverage enabled, force link ld to ld.bfd
123 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
124 # See bootstrap/.gitlab-ci.yml how to generate a new image
125 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
126 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
127 - echo "SAMBA_CI_JOB_IMAGE[${SAMBA_CI_JOB_IMAGE}]"
128 - echo "CI_JOB_IMAGE[${CI_JOB_IMAGE}]"
129 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
130 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
131 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
132 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
133 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
134 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
135 - export CCACHE_BASEDIR="${PWD}"
136 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
137 - export CC="ccache cc"
138 - export CXX="ccache c++"
141 # We are already running .gitlab-ci directives from this repo, remove additional checks that break our CI
142 - git config --global --add safe.directory `pwd`
148 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
160 - runner_system_failure
161 - stuck_or_timeout_failure
167 - data_integrity_failure
170 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
171 # autobuild name, which means we can define a default template that runs most autobuild jobs
172 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
174 # Ensure when adding a new job below that you also add it to
175 # the dependencies for 'pages' below for the code coverage page
179 extends: .shared_template
181 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
182 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
183 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
184 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
185 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
186 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
187 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
188 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
190 .shared_template_build_only:
191 extends: .shared_template
203 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
204 # autobuild name, which means we can define a default template that runs most autobuild jobs
205 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
206 # On success we need to pack everything into an artifacts file
207 # which needs to be in the git checkout.
208 # As tar doesn't handle hardlink of read-only files,
209 # we remember the acls and add write permissions
210 # before creating the archive. The consumer will apply
212 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
213 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
214 - ln -s /tmp/samba-testbase/${AUTOBUILD_JOB_NAME}/ /tmp/samba-testbase/build_subdir_link
215 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
216 - chmod -R +w /tmp/samba-testbase
217 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
218 - tar $SAMBA_TESTBASE_TAR_OPTIONS -cf samba-testbase.tar /tmp/samba-testbase
219 - ls -la samba-testbase.tar
220 - sha1sum samba-testbase.tar
222 .shared_template_test_only:
225 - .shared_runner_test
228 # Print the Kerberos version to check we ended up with the right one
229 # in the runner. We do not have configure output to recognize it
231 - if [ -x "$(command -v krb5-config)" ]; then krb5-config --version; fi
232 # We unpack the artifacts file created by the .shared_template_build_only
234 - ls -la samba-testbase.tar
235 - sha1sum samba-testbase.tar
236 - tar $SAMBA_TESTBASE_TAR_OPTIONS -xf samba-testbase.tar -C /
237 - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
238 - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
239 - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
240 - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
241 - ls -la /tmp/samba-testbase/
242 - ls -la /tmp/samba-testbase/build_subdir_link
243 - ls -la /tmp/samba-testbase/build_subdir_link/
244 - 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
245 - ls -la /tmp/samba-testbase/build_subdir_link/
246 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
247 # autobuild name, which means we can define a default template that runs most autobuild jobs
248 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
251 extends: .shared_template_build_only
254 .needs_samba-def-build:
255 extends: .shared_template_test_only
257 - job: samba-def-build
259 - job: samba-shellcheck
262 extends: .shared_template_build_only
264 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
268 extends: .shared_template_build_only
270 AUTOBUILD_JOB_NAME: samba-mit-build
271 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_f36mit120}
274 .needs_samba-mit-build:
275 extends: .shared_template_test_only
277 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
279 - job: samba-mit-build
281 - job: samba-shellcheck
283 .needs_samba-mit120-build:
284 extends: .shared_template_test_only
286 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_f36mit120}
288 - job: samba-mit120-build
292 extends: .shared_template_build_only
294 .needs_samba-h5l-build:
295 extends: .shared_template_test_only
297 - job: samba-h5l-build
300 samba-without-smb1-build:
301 extends: .shared_template_build_only
303 .needs_samba-without-smb1-build:
304 extends: .shared_template_test_only
306 - job: samba-without-smb1-build
310 extends: .shared_template_build_only
312 .needs_samba-nt4-build:
313 extends: .shared_template_test_only
315 - job: samba-nt4-build
318 samba-no-opath-build:
319 extends: .shared_template_build_only
321 .needs_samba-no-opath-build:
322 extends: .shared_template_test_only
324 - job: samba-no-opath-build
328 extends: .shared_template
331 extends: .shared_template
333 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
336 extends: .shared_template
339 extends: .shared_template
342 extends: .needs_samba-def-build
345 extends: .needs_samba-def-build
348 extends: .needs_samba-def-build
351 extends: .needs_samba-def-build
354 extends: .needs_samba-def-build
357 extends: .needs_samba-def-build
360 extends: .needs_samba-def-build
363 extends: .needs_samba-def-build
366 extends: .needs_samba-def-build
369 extends: .needs_samba-def-build
372 extends: .shared_template
375 extends: .shared_template
377 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
380 extends: .shared_template
383 extends: .shared_template
386 extends: .needs_samba-def-build
389 extends: .needs_samba-mit-build
392 extends: .needs_samba-mit-build
395 extends: .needs_samba-mit-build
397 # This task is run first to ensure we compile before we start the
398 # main run as it is the fastest full compile of Samba.
400 extends: .shared_template
402 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
405 extends: .shared_template
408 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
412 extends: .private_runner_test
415 # See above, to avoid a duplicate CI on the MR (these rules override the others)
416 - if: $CI_MERGE_REQUEST_ID
419 # These jobs are only run if the gitlab repo has private runners available.
420 # To enable private jobs, you must add the following var and value to
421 # your gitlab repo by navigating to:
422 # settings -> CI/CD -> Environment variables
423 - if: $SUPPORT_PRIVATE_TEST == "yes"
425 .needs_samba-def-build-private:
427 - .needs_samba-def-build
430 .needs_samba-mit-build-private:
432 - .needs_samba-mit-build
435 .needs_samba-mit120-build-private:
437 - .needs_samba-mit120-build
440 .needs_samba-h5l-build-private:
442 - .needs_samba-h5l-build
445 .needs_samba-without-smb1-build-private:
447 - .needs_samba-without-smb1-build
450 .needs_samba-nt4-build-private:
452 - .needs_samba-nt4-build
455 .needs_samba-no-opath-build-private:
457 - .needs_samba-no-opath-build
461 extends: .needs_samba-h5l-build-private
463 samba-fileserver-without-smb1:
464 extends: .needs_samba-without-smb1-build-private
466 # This is a full build without the AD DC so we test the build with MIT
467 # Kerberos from the default system (Ubuntu 18.04 at this stage).
468 # Runtime behaviour checked via the ktest (static ccache and keytab)
471 extends: .shared_template
474 extends: .needs_samba-def-build-private
477 extends: .needs_samba-nt4-build-private
480 extends: .needs_samba-mit-build-private
483 extends: .needs_samba-mit120-build-private
485 AUTOBUILD_JOB_NAME: samba-addc-mit-1
488 extends: .needs_samba-no-opath-build-private
491 extends: .needs_samba-no-opath-build-private
493 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
495 extends: .shared_runner_build_image
497 dependencies: # tell gitlab to download artifacts for these jobs
521 - samba-fileserver-without-smb1
524 - samba-schemaupgrade
529 - ubuntu1804-samba-o3
532 - ./configure.developer
535 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
537 - genhtml all.info --ignore-errors source --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
544 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
548 extends: .shared_runner_build_image
550 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse153}
553 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
554 - tar xf /tmp/coverity_tool.tgz
555 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
556 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
557 - tar czf cov-int.tar.gz cov-int
559 --form token=$COVERITY_SCAN_TOKEN
560 --form email=$COVERITY_SCAN_EMAIL
561 --form file=@cov-int.tar.gz
562 --form version="`git describe --tags`"
563 --form description="CI build"
564 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
570 - $COVERITY_SCAN_TOKEN != null
571 - $COVERITY_SCAN_PROJECT_NAME != null
572 - $COVERITY_SCAN_EMAIL != null
580 # We build samba-o3 on all supported distributions
583 # This job, which matches the main CI, needs to still do coverage so
584 # we show the coverage on the "none" environment tests
586 # We want --enable-coverage specified here otherwise we will have a
587 # different set of build options on the coverage build and can fail
588 # when -O3 gets combined with --enable-coverage in the scheduled
592 extends: .shared_template
594 AUTOBUILD_JOB_NAME: samba-o3
595 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804}
596 SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: "--enable-coverage"
598 # See above, to avoid a duplicate CI on the MR (these rules override the others)
599 - if: $CI_MERGE_REQUEST_ID
601 # do not run o3 builds (which run a lot of VMs) if told not to
602 # (this uses the same variable as autobuild.py)
603 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
606 # All other jobs do not want code coverage.
608 extends: .shared_template
610 AUTOBUILD_JOB_NAME: samba-o3
612 # See above, to avoid a duplicate CI on the MR (these rules override the others)
613 - if: $CI_MERGE_REQUEST_ID
615 # do not run o3 builds (which run a lot of VMs) if told not to
616 # (this uses the same variable as autobuild.py)
617 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
619 # do not run o3 for coverage since they are using different images
620 - if: $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
623 extends: .samba-o3-template
625 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
628 extends: .samba-o3-template
630 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_debian11}
632 opensuse153-samba-o3:
633 extends: .samba-o3-template
635 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse153}
638 extends: .samba-o3-template
640 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos7}
641 # Git on CentOS doesn't support shallow git cloning
643 # We need a newer GnuTLS version on CentOS7
644 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls37/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
647 extends: .samba-o3-template
649 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos8s}
652 extends: .samba-o3-template
654 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora36}
657 # Keep the samba-o3 sections at the end ...