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: cf0a5476a4f13d449a7542d01d225dc2aef2a333
52 # We use the ubuntu2204 image as default as
53 # it matches what we have on atb-devel-224
55 SAMBA_CI_CONTAINER_IMAGE: ubuntu2204
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_ubuntu1804_32bit: ubuntu1804-32bit
63 SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ubuntu2004
64 SAMBA_CI_CONTAINER_IMAGE_ubuntu2204: ubuntu2204
65 SAMBA_CI_CONTAINER_IMAGE_debian11: debian11
66 SAMBA_CI_CONTAINER_IMAGE_opensuse154: opensuse154
67 SAMBA_CI_CONTAINER_IMAGE_fedora38: fedora38
68 SAMBA_CI_CONTAINER_IMAGE_centos7: centos7
69 SAMBA_CI_CONTAINER_IMAGE_centos8s: centos8s
72 # The image creation details are specified in a separate file
73 # See bootstrap/README.md for details
74 - 'bootstrap/.gitlab-ci.yml'
76 .shared_runner_build_image:
77 extends: .shared_runner_build
79 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE}
80 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_JOB_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
83 extends: .shared_runner_build_image
84 # All Samba jobs are interruptible, this avoids burning CPU when a
85 # newer branch is pushed.
89 # Otherwise we run twice, once on push and once on MR
90 # https://forum.gitlab.com/t/new-rules-syntax-and-detached-pipelines/37292
92 - if: $CI_MERGE_REQUEST_ID
97 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
100 key: ccache.${CI_JOB_NAME}.${SAMBA_CI_JOB_IMAGE}.${SAMBA_CI_FLAVOR}
104 # This is overridden in many cases, but ensures none of the other
105 # main jobs start until and unless this build finishes. However
106 # this also ensures we do not download artifacts from any build
107 # unless we specifically depend on it, saving bandwidth
110 - job: samba-def-build
116 - cat /etc/os-release
123 # ld will fail if coverage enabled, force link ld to ld.bfd
124 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
125 # See bootstrap/.gitlab-ci.yml how to generate a new image
126 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
127 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
128 - echo "SAMBA_CI_JOB_IMAGE[${SAMBA_CI_JOB_IMAGE}]"
129 - echo "CI_JOB_IMAGE[${CI_JOB_IMAGE}]"
130 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
131 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
132 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
133 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
134 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
135 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
136 - export CCACHE_BASEDIR="${PWD}"
137 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
138 - export CC="ccache cc"
139 - export CXX="ccache c++"
142 # We are already running .gitlab-ci directives from this repo, remove additional checks that break our CI
143 - git config --global --add safe.directory `pwd`
149 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
161 - runner_system_failure
162 - stuck_or_timeout_failure
168 - data_integrity_failure
171 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
172 # autobuild name, which means we can define a default template that runs most autobuild jobs
173 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
175 # Ensure when adding a new job below that you also add it to
176 # the dependencies for 'pages' below for the code coverage page
180 extends: .shared_template
182 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
183 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
184 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
185 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
186 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
187 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
188 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
189 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
191 .shared_template_build_only:
192 extends: .shared_template
204 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
205 # autobuild name, which means we can define a default template that runs most autobuild jobs
206 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
207 # On success we need to pack everything into an artifacts file
208 # which needs to be in the git checkout.
209 # As tar doesn't handle hardlink of read-only files,
210 # we remember the acls and add write permissions
211 # before creating the archive. The consumer will apply
213 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
214 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
215 - ln -s /tmp/samba-testbase/${AUTOBUILD_JOB_NAME}/ /tmp/samba-testbase/build_subdir_link
216 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
217 - chmod -R +w /tmp/samba-testbase
218 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
219 - tar $SAMBA_TESTBASE_TAR_OPTIONS -cf samba-testbase.tar /tmp/samba-testbase
220 - ls -la samba-testbase.tar
221 - sha1sum samba-testbase.tar
223 .shared_template_test_only:
226 - .shared_runner_test
229 # Print the Kerberos version to check we ended up with the right one
230 # in the runner. We do not have configure output to recognize it
232 - if [ -x "$(command -v krb5-config)" ]; then krb5-config --version; fi
233 # We unpack the artifacts file created by the .shared_template_build_only
235 - ls -la samba-testbase.tar
236 - sha1sum samba-testbase.tar
237 - tar $SAMBA_TESTBASE_TAR_OPTIONS -xf samba-testbase.tar -C /
238 - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
239 - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
240 - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
241 - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
242 - ls -la /tmp/samba-testbase/
243 - ls -la /tmp/samba-testbase/build_subdir_link
244 - ls -la /tmp/samba-testbase/build_subdir_link/
245 - 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
246 - ls -la /tmp/samba-testbase/build_subdir_link/
247 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
248 # autobuild name, which means we can define a default template that runs most autobuild jobs
249 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
252 extends: .shared_template_build_only
255 .needs_samba-def-build:
256 extends: .shared_template_test_only
258 - job: samba-def-build
260 - job: samba-shellcheck
263 extends: .shared_template_build_only
265 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
268 .needs_samba-mit-build:
269 extends: .shared_template_test_only
271 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
273 - job: samba-mit-build
275 - job: samba-shellcheck
278 extends: .shared_template_build_only
280 .needs_samba-h5l-build:
281 extends: .shared_template_test_only
283 - job: samba-h5l-build
286 samba-without-smb1-build:
287 extends: .shared_template_build_only
289 .needs_samba-without-smb1-build:
290 extends: .shared_template_test_only
292 - job: samba-without-smb1-build
296 extends: .shared_template_build_only
298 .needs_samba-nt4-build:
299 extends: .shared_template_test_only
301 - job: samba-nt4-build
304 samba-no-opath-build:
305 extends: .shared_template_build_only
307 .needs_samba-no-opath-build:
308 extends: .shared_template_test_only
310 - job: samba-no-opath-build
314 extends: .shared_template
317 extends: .shared_template
319 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
322 extends: .shared_template
325 extends: .shared_template
328 extends: .needs_samba-def-build
331 extends: .needs_samba-def-build
334 extends: .needs_samba-def-build
337 extends: .needs_samba-def-build
340 extends: .needs_samba-def-build
343 extends: .needs_samba-def-build
346 extends: .needs_samba-def-build
349 extends: .needs_samba-def-build
352 extends: .needs_samba-def-build
355 extends: .needs_samba-def-build
358 extends: .shared_template
361 extends: .shared_template
363 # We match what Google is running over at oss-fuzz
364 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
367 extends: .shared_template
370 extends: .shared_template
373 extends: .needs_samba-def-build
376 extends: .needs_samba-mit-build
379 extends: .needs_samba-mit-build
382 extends: .needs_samba-mit-build
384 # This task is run first to ensure we compile before we start the
385 # main run as it is the fastest full compile of Samba.
387 extends: .shared_template
389 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
392 extends: .shared_template
395 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
399 extends: .private_runner_test
402 # See above, to avoid a duplicate CI on the MR (these rules override the others)
403 - if: $CI_MERGE_REQUEST_ID
406 # These jobs are only run if the gitlab repo has private runners available.
407 # To enable private jobs, you must add the following var and value to
408 # your gitlab repo by navigating to:
409 # settings -> CI/CD -> Environment variables
410 - if: $SUPPORT_PRIVATE_TEST == "yes"
412 .needs_samba-def-build-private:
414 - .needs_samba-def-build
417 .needs_samba-mit-build-private:
419 - .needs_samba-mit-build
422 .needs_samba-h5l-build-private:
424 - .needs_samba-h5l-build
427 .needs_samba-without-smb1-build-private:
429 - .needs_samba-without-smb1-build
432 .needs_samba-nt4-build-private:
434 - .needs_samba-nt4-build
437 .needs_samba-no-opath-build-private:
439 - .needs_samba-no-opath-build
443 extends: .needs_samba-h5l-build-private
445 samba-fileserver-without-smb1:
446 extends: .needs_samba-without-smb1-build-private
448 # This is a full build without the AD DC so we test the build with MIT
449 # Kerberos from the default system (Ubuntu 18.04 at this stage).
450 # Runtime behaviour checked via the ktest (static ccache and keytab)
453 extends: .shared_template
456 extends: .needs_samba-def-build-private
459 extends: .needs_samba-nt4-build-private
462 extends: .needs_samba-mit-build-private
465 extends: .needs_samba-no-opath-build-private
468 extends: .needs_samba-no-opath-build-private
470 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
472 extends: .shared_runner_build_image
474 dependencies: # tell gitlab to download artifacts for these jobs
498 - samba-fileserver-without-smb1
501 - samba-schemaupgrade
506 - ubuntu1804-samba-o3
509 - ./configure.developer
512 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
514 - genhtml all.info --ignore-errors source --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
521 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
525 extends: .shared_runner_build_image
527 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse154}
530 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
531 - tar xf /tmp/coverity_tool.tgz
532 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
533 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
534 - tar czf cov-int.tar.gz cov-int
536 --form token=$COVERITY_SCAN_TOKEN
537 --form email=$COVERITY_SCAN_EMAIL
538 --form file=@cov-int.tar.gz
539 --form version="`git describe --tags`"
540 --form description="CI build"
541 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
547 - $COVERITY_SCAN_TOKEN != null
548 - $COVERITY_SCAN_PROJECT_NAME != null
549 - $COVERITY_SCAN_EMAIL != null
556 ubuntu1804-samba-32bit:
557 extends: .shared_template
559 AUTOBUILD_JOB_NAME: samba-32bit
560 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804_32bit}
563 # We build samba-o3 on all supported distributions
566 # This job, which matches the main CI, needs to still do coverage so
567 # we show the coverage on the "none" environment tests
569 # We want --enable-coverage specified here otherwise we will have a
570 # different set of build options on the coverage build and can fail
571 # when -O3 gets combined with --enable-coverage in the scheduled
575 extends: .shared_template
577 AUTOBUILD_JOB_NAME: samba-o3
578 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804}
579 SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: "--enable-coverage"
581 # See above, to avoid a duplicate CI on the MR (these rules override the others)
582 - if: $CI_MERGE_REQUEST_ID
584 # do not run o3 builds (which run a lot of VMs) if told not to
585 # (this uses the same variable as autobuild.py)
586 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
589 # All other jobs do not want code coverage.
591 extends: .shared_template
593 AUTOBUILD_JOB_NAME: samba-o3
595 # See above, to avoid a duplicate CI on the MR (these rules override the others)
596 - if: $CI_MERGE_REQUEST_ID
598 # do not run o3 builds (which run a lot of VMs) if told not to
599 # (this uses the same variable as autobuild.py)
600 - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
602 # do not run o3 for coverage since they are using different images
603 - if: $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
606 extends: .samba-o3-template
608 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
611 extends: .samba-o3-template
613 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2204}
616 extends: .samba-o3-template
618 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_debian11}
620 opensuse154-samba-o3:
621 extends: .samba-o3-template
623 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse154}
626 extends: .samba-o3-template
628 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos7}
629 # Git on CentOS doesn't support shallow git cloning
631 # We need a newer GnuTLS version on CentOS7
632 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls37/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
635 extends: .samba-o3-template
637 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos8s}
640 extends: .samba-o3-template
642 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora38}
645 # Keep the samba-o3 sections at the end ...