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: c4c00eb35cae36d8d6e752ee01fd943432993721
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: .shared_template
291 extends: .shared_template
292 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
295 extends: .shared_template
298 extends: .shared_template
301 extends: .needs_samba-def-build
304 extends: .needs_samba-mit-build
306 samba-ad-dc-4-mitkrb5:
307 extends: .needs_samba-mit-build
309 # This task is run first to ensure we compile before we start the
310 # main run as it is the fastest full compile of Samba.
312 extends: .shared_template
313 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
322 # These jobs are only run if the gitlab repo has private runners available.
323 # To enable private jobs, you must add the following var and value to
324 # your gitlab repo by navigating to:
325 # settings -> CI/CD -> Environment variables
326 - $SUPPORT_PRIVATE_TEST == "yes"
328 .needs_samba-def-build-private:
330 - .needs_samba-def-build
333 .needs_samba-mit-build-private:
335 - .needs_samba-mit-build
338 .needs_samba-h5l-build-private:
340 - .needs_samba-h5l-build
343 .needs_samba-nt4-build-private:
345 - .needs_samba-nt4-build
348 .needs_samba-no-opath-build-private:
350 - .needs_samba-no-opath-build
354 extends: .needs_samba-def-build-private
357 extends: .needs_samba-h5l-build-private
360 extends: .needs_samba-def-build-private
363 extends: .needs_samba-nt4-build-private
366 extends: .needs_samba-def-build-private
368 samba-ad-dc-1-mitkrb5:
369 extends: .needs_samba-mit-build-private
372 extends: .needs_samba-no-opath-build-private
374 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
376 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
381 dependencies: # tell gitlab to download artifacts for these jobs
398 - 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"
422 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
427 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
428 - tar xf /tmp/coverity_tool.tgz
429 - ./configure.developer --with-system-mitkrb5 --with-experimental-mit-ad-dc
430 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
431 - tar czf cov-int.tar.gz cov-int
433 --form token=$COVERITY_SCAN_TOKEN
434 --form email=$COVERITY_SCAN_EMAIL
435 --form file=@cov-int.tar.gz
436 --form version="`git describe --tags`"
437 --form description="CI build"
438 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
444 - $COVERITY_SCAN_TOKEN != null
445 - $COVERITY_SCAN_PROJECT_NAME != null
446 - $COVERITY_SCAN_EMAIL != null
454 # We build samba-o3 on all supported distributions
458 extends: .shared_template
460 AUTOBUILD_JOB_NAME: samba-o3
463 # do not run o3 for coverage since they are using different images
464 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
467 extends: .samba-o3-template
468 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
471 extends: .samba-o3-template
472 image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu2004
475 extends: .samba-o3-template
476 image: $SAMBA_CI_CONTAINER_IMAGE_debian10
478 opensuse151-samba-o3:
479 extends: .samba-o3-template
480 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
482 opensuse152-samba-o3:
483 extends: .samba-o3-template
484 image: $SAMBA_CI_CONTAINER_IMAGE_opensuse152
487 extends: .samba-o3-template
488 image: $SAMBA_CI_CONTAINER_IMAGE_centos7
490 # Git on CentOS doesn't support shallow git cloning
492 # We need a newer GnuTLS version on CentOS7
493 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
496 extends: .samba-o3-template
497 image: $SAMBA_CI_CONTAINER_IMAGE_centos8
500 extends: .samba-o3-template
501 image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
504 extends: .samba-o3-template
505 image: $SAMBA_CI_CONTAINER_IMAGE_fedora33
508 # Keep the samba-o3 sections at the end ...