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 # All Samba jobs are interruptible, this avoids burning CPU when a
77 # newer branch is pushed.
82 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
83 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
89 key: ccache.${CI_JOB_NAME}
102 # ld will fail if coverage enabled, force link ld to ld.bfd
103 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
104 # See bootstrap/.gitlab-ci.yml how to generate a new image
105 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
106 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
107 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
108 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
109 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
110 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
111 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
112 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
113 - export CCACHE_BASEDIR="${PWD}"
114 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
115 - export CC="ccache cc"
116 - export CXX="ccache c++"
124 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
135 - runner_system_failure
136 - stuck_or_timeout_failure
140 - job_execution_timeout
143 - data_integrity_failure
146 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
147 # autobuild name, which means we can define a default template that runs most autobuild jobs
148 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
150 # Ensure when adding a new job below that you also add it to
151 # the dependencies for 'pages' below for the code coverage page
155 extends: .shared_template
157 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
158 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
159 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
160 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
161 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
162 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
163 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
164 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
166 .shared_template_build_only:
167 extends: .shared_template
176 - samba-testbase.tar.gz
178 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
179 # autobuild name, which means we can define a default template that runs most autobuild jobs
180 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
181 # On success we need to pack everything into an artifacts file
182 # which needs to be in the git checkout.
183 # As tar doesn't handle hardlink of read-only files,
184 # we remember the acls and add write permissions
185 # before creating the archive. The consumer will apply
187 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
188 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
189 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
190 - chmod -R +w /tmp/samba-testbase
191 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
192 - tar cfz samba-testbase.tar.gz /tmp/samba-testbase
193 - ls -la samba-testbase.tar.gz
194 - sha1sum samba-testbase.tar.gz
196 .shared_template_test_only:
197 extends: .shared_template
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
331 # These jobs are only run if the gitlab repo has private runners available.
332 # To enable private jobs, you must add the following var and value to
333 # your gitlab repo by navigating to:
334 # settings -> CI/CD -> Environment variables
335 - $SUPPORT_PRIVATE_TEST == "yes"
337 .needs_samba-def-build-private:
339 - .needs_samba-def-build
342 .needs_samba-mit-build-private:
344 - .needs_samba-mit-build
347 .needs_samba-h5l-build-private:
349 - .needs_samba-h5l-build
352 .needs_samba-nt4-build-private:
354 - .needs_samba-nt4-build
357 .needs_samba-no-opath-build-private:
359 - .needs_samba-no-opath-build
363 extends: .needs_samba-h5l-build-private
366 extends: .needs_samba-def-build-private
369 extends: .needs_samba-nt4-build-private
371 samba-ad-dc-1-mitkrb5:
372 extends: .needs_samba-mit-build-private
375 extends: .needs_samba-no-opath-build-private
377 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
379 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
384 dependencies: # tell gitlab to download artifacts for these jobs
401 - samba-ad-dc-4-mitkrb5
407 - samba-schemaupgrade
408 - samba-ad-dc-1-mitkrb5
411 - ./configure.developer
413 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
414 - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
421 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
426 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
431 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
432 - tar xf /tmp/coverity_tool.tgz
433 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
434 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
435 - tar czf cov-int.tar.gz cov-int
437 --form token=$COVERITY_SCAN_TOKEN
438 --form email=$COVERITY_SCAN_EMAIL
439 --form file=@cov-int.tar.gz
440 --form version="`git describe --tags`"
441 --form description="CI build"
442 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
448 - $COVERITY_SCAN_TOKEN != null
449 - $COVERITY_SCAN_PROJECT_NAME != null
450 - $COVERITY_SCAN_EMAIL != null
458 # We build samba-o3 on all supported distributions
462 extends: .shared_template
464 AUTOBUILD_JOB_NAME: samba-o3
467 # do not run o3 for coverage since they are using different images
468 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
471 extends: .samba-o3-template
472 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
475 extends: .samba-o3-template
476 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu2004
479 extends: .samba-o3-template
480 image: $SAMBA_CI_CONTAINER_IMAGE_debian10
482 opensuse151-samba-o3:
483 extends: .samba-o3-template
484 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
486 opensuse152-samba-o3:
487 extends: .samba-o3-template
488 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse152
491 extends: .samba-o3-template
492 image: $SAMBA_CI_CONTAINER_IMAGE_centos7
494 # Git on CentOS doesn't support shallow git cloning
496 # We need a newer GnuTLS version on CentOS7
497 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
500 extends: .samba-o3-template
501 image: $SAMBA_CI_CONTAINER_IMAGE_centos8
504 extends: .samba-o3-template
505 image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
508 extends: .samba-o3-template
509 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
512 # Keep the samba-o3 sections at the end ...