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"
33 # "--enable-coverage" or ""
34 SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: ""
36 # we run autobuild.py inside a samba CI docker image located on gitlab's registry
37 # overwrite this variable if you want use your own image registry.
39 # Or better ask for access to the shared development repository, see
40 # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
42 SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
44 # Set this to the contents of bootstrap/sha1sum.txt
45 # which is generated by bootstrap/template.py --render
47 SAMBA_CI_CONTAINER_TAG: f25e1fa0a828f428ade0e4f37d8a646ff1e207d4
49 # We use the ubuntu1804 image as default as
50 # it matches what we have on sn-devel-184.
52 SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
54 # The following images are available
55 # Please see the samba-o3 sections at the end of this file!
56 # We should run that for each available image
58 SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
59 SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
60 SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu2004:${SAMBA_CI_CONTAINER_TAG}
61 SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
62 SAMBA_CI_CONTAINER_IMAGE_debian10: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian10:${SAMBA_CI_CONTAINER_TAG}
63 SAMBA_CI_CONTAINER_IMAGE_opensuse151: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse151:${SAMBA_CI_CONTAINER_TAG}
64 SAMBA_CI_CONTAINER_IMAGE_opensuse152: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse152:${SAMBA_CI_CONTAINER_TAG}
65 SAMBA_CI_CONTAINER_IMAGE_fedora32: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora32:${SAMBA_CI_CONTAINER_TAG}
66 SAMBA_CI_CONTAINER_IMAGE_fedora33: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora33:${SAMBA_CI_CONTAINER_TAG}
67 SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
68 SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
71 # The image creation details are specified in a separate file
72 # See bootstrap/README.md for details
73 - 'bootstrap/.gitlab-ci.yml'
76 extends: .shared_runner_build
77 # All Samba jobs are interruptible, this avoids burning CPU when a
78 # newer branch is pushed.
83 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
84 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
87 key: ccache.${CI_JOB_NAME}
100 # ld will fail if coverage enabled, force link ld to ld.bfd
101 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
102 # See bootstrap/.gitlab-ci.yml how to generate a new image
103 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
104 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
105 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
106 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
107 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
108 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
109 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
110 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
111 - export CCACHE_BASEDIR="${PWD}"
112 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
113 - export CC="ccache cc"
114 - export CXX="ccache c++"
122 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
133 - runner_system_failure
134 - stuck_or_timeout_failure
138 - job_execution_timeout
141 - data_integrity_failure
144 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
145 # autobuild name, which means we can define a default template that runs most autobuild jobs
146 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
148 # Ensure when adding a new job below that you also add it to
149 # the dependencies for 'pages' below for the code coverage page
153 extends: .shared_template
155 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
156 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
157 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
158 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
159 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
160 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
161 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
162 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
164 .shared_template_build_only:
165 extends: .shared_template
174 - samba-testbase.tar.gz
176 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
177 # autobuild name, which means we can define a default template that runs most autobuild jobs
178 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
179 # On success we need to pack everything into an artifacts file
180 # which needs to be in the git checkout.
181 # As tar doesn't handle hardlink of read-only files,
182 # we remember the acls and add write permissions
183 # before creating the archive. The consumer will apply
185 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
186 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
187 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
188 - chmod -R +w /tmp/samba-testbase
189 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
190 - tar cfz samba-testbase.tar.gz /tmp/samba-testbase
191 - ls -la samba-testbase.tar.gz
192 - sha1sum samba-testbase.tar.gz
194 .shared_template_test_only:
197 - .shared_runner_test
200 # We unpack the artifacts file created by the .shared_template_build_only
202 - ls -la samba-testbase.tar.gz
203 - sha1sum samba-testbase.tar.gz
204 - tar xfz samba-testbase.tar.gz -C /
205 - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
206 - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
207 - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
208 - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
209 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
210 # autobuild name, which means we can define a default template that runs most autobuild jobs
211 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
214 extends: .shared_template_build_only
217 .needs_samba-def-build:
218 extends: .shared_template_test_only
220 - job: samba-def-build
224 extends: .shared_template_build_only
227 .needs_samba-mit-build:
228 extends: .shared_template_test_only
230 - job: samba-mit-build
234 extends: .shared_template_build_only
236 .needs_samba-h5l-build:
237 extends: .shared_template_test_only
239 - job: samba-h5l-build
243 extends: .shared_template_build_only
245 .needs_samba-nt4-build:
246 extends: .shared_template_test_only
248 - job: samba-nt4-build
251 samba-no-opath-build:
252 extends: .shared_template_build_only
254 .needs_samba-no-opath-build:
255 extends: .shared_template_test_only
257 - job: samba-no-opath-build
261 extends: .shared_template
264 extends: .shared_template
267 extends: .shared_template
270 extends: .needs_samba-def-build
273 extends: .needs_samba-def-build
276 extends: .needs_samba-def-build
279 extends: .needs_samba-def-build
282 extends: .needs_samba-def-build
285 extends: .needs_samba-def-build
288 extends: .needs_samba-def-build
291 extends: .needs_samba-def-build
294 extends: .needs_samba-def-build
297 extends: .shared_template
300 extends: .shared_template
301 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
304 extends: .shared_template
307 extends: .shared_template
310 extends: .needs_samba-def-build
313 extends: .needs_samba-mit-build
315 samba-ad-dc-4-mitkrb5:
316 extends: .needs_samba-mit-build
318 # This task is run first to ensure we compile before we start the
319 # main run as it is the fastest full compile of Samba.
321 extends: .shared_template
322 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
325 extends: .private_runner_test
329 # These jobs are only run if the gitlab repo has private runners available.
330 # To enable private jobs, you must add the following var and value to
331 # your gitlab repo by navigating to:
332 # settings -> CI/CD -> Environment variables
333 - $SUPPORT_PRIVATE_TEST == "yes"
335 .needs_samba-def-build-private:
337 - .needs_samba-def-build
340 .needs_samba-mit-build-private:
342 - .needs_samba-mit-build
345 .needs_samba-h5l-build-private:
347 - .needs_samba-h5l-build
350 .needs_samba-nt4-build-private:
352 - .needs_samba-nt4-build
355 .needs_samba-no-opath-build-private:
357 - .needs_samba-no-opath-build
361 extends: .needs_samba-h5l-build-private
364 extends: .needs_samba-def-build-private
367 extends: .needs_samba-nt4-build-private
369 samba-ad-dc-1-mitkrb5:
370 extends: .needs_samba-mit-build-private
373 extends: .needs_samba-no-opath-build-private
375 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
377 extends: .shared_runner_build
378 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
380 dependencies: # tell gitlab to download artifacts for these jobs
397 - samba-ad-dc-4-mitkrb5
403 - samba-schemaupgrade
404 - samba-ad-dc-1-mitkrb5
407 - ./configure.developer
409 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
410 - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
417 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
421 extends: .shared_runner_build
423 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
425 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
426 - tar xf /tmp/coverity_tool.tgz
427 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
428 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
429 - tar czf cov-int.tar.gz cov-int
431 --form token=$COVERITY_SCAN_TOKEN
432 --form email=$COVERITY_SCAN_EMAIL
433 --form file=@cov-int.tar.gz
434 --form version="`git describe --tags`"
435 --form description="CI build"
436 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
442 - $COVERITY_SCAN_TOKEN != null
443 - $COVERITY_SCAN_PROJECT_NAME != null
444 - $COVERITY_SCAN_EMAIL != null
452 # We build samba-o3 on all supported distributions
456 extends: .shared_template
458 AUTOBUILD_JOB_NAME: samba-o3
461 # do not run o3 for coverage since they are using different images
462 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
465 extends: .samba-o3-template
466 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
469 extends: .samba-o3-template
470 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu2004
473 extends: .samba-o3-template
474 image: $SAMBA_CI_CONTAINER_IMAGE_debian10
476 opensuse151-samba-o3:
477 extends: .samba-o3-template
478 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
480 opensuse152-samba-o3:
481 extends: .samba-o3-template
482 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse152
485 extends: .samba-o3-template
486 image: $SAMBA_CI_CONTAINER_IMAGE_centos7
488 # Git on CentOS doesn't support shallow git cloning
490 # We need a newer GnuTLS version on CentOS7
491 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
494 extends: .samba-o3-template
495 image: $SAMBA_CI_CONTAINER_IMAGE_centos8
498 extends: .samba-o3-template
499 image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
502 extends: .samba-o3-template
503 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
506 # Keep the samba-o3 sections at the end ...