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 # we run autobuild.py inside a samba CI docker image located on gitlab's registry
35 # overwrite this variable if you want use your own image registry.
37 # Or better ask for access to the shared development repository, see
38 # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
40 SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
42 # Set this to the contents of bootstrap/sha1sum.txt
43 # which is generated by bootstrap/template.py --render
45 SAMBA_CI_CONTAINER_TAG: fa3eeb92fb5447524a057a4c377e6960dff626ce
47 # We use the ubuntu1804 image as default as
48 # it matches what we have on sn-devel-184.
50 SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
52 # The following images are available
53 # Please see the samba-o3 sections at the end of this file!
54 # We should run that for each available image
56 SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ubuntu1604
57 SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ubuntu1804
58 SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ubuntu2004
59 SAMBA_CI_CONTAINER_IMAGE_debian9: debian9
60 SAMBA_CI_CONTAINER_IMAGE_debian10: debian10
61 SAMBA_CI_CONTAINER_IMAGE_opensuse151: opensuse151
62 SAMBA_CI_CONTAINER_IMAGE_opensuse152: opensuse152
63 SAMBA_CI_CONTAINER_IMAGE_fedora33: fedora33
64 SAMBA_CI_CONTAINER_IMAGE_fedora34: fedora34
65 SAMBA_CI_CONTAINER_IMAGE_centos7: centos7
66 SAMBA_CI_CONTAINER_IMAGE_centos8: centos8
69 # The image creation details are specified in a separate file
70 # See bootstrap/README.md for details
71 - 'bootstrap/.gitlab-ci.yml'
73 .shared_runner_build_image:
74 extends: .shared_runner_build
76 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE}
77 image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_JOB_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
80 extends: .shared_runner_build_image
81 # All Samba jobs are interruptible, this avoids burning CPU when a
82 # newer branch is pushed.
87 AUTOBUILD_JOB_NAME: $CI_JOB_NAME
90 key: ccache.${CI_JOB_NAME}.${SAMBA_CI_JOB_IMAGE}.${SAMBA_CI_FLAVOR}
103 # ld will fail if coverage enabled, force link ld to ld.bfd
104 - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
105 # See bootstrap/.gitlab-ci.yml how to generate a new image
106 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
107 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
108 - echo "SAMBA_CI_JOB_IMAGE[${SAMBA_CI_JOB_IMAGE}]"
109 - echo "CI_JOB_IMAGE[${CI_JOB_IMAGE}]"
110 - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
111 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
112 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
113 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
114 - diff -u bootstrap/sha1sum.txt /sha1sum.txt
115 - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
116 - export CCACHE_BASEDIR="${PWD}"
117 - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
118 - export CC="ccache cc"
119 - export CXX="ccache c++"
127 - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
139 - runner_system_failure
140 - stuck_or_timeout_failure
144 - job_execution_timeout
147 - data_integrity_failure
150 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
151 # autobuild name, which means we can define a default template that runs most autobuild jobs
152 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
154 # Ensure when adding a new job below that you also add it to
155 # the dependencies for 'pages' below for the code coverage page
159 extends: .shared_template
161 - script/autobuild.py ldb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/ldb
162 - script/autobuild.py pidl $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/pidl
163 - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/replace
164 - script/autobuild.py talloc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/talloc
165 - script/autobuild.py tdb $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tdb
166 - script/autobuild.py tevent $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/tevent
167 - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
168 - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
170 .shared_template_build_only:
171 extends: .shared_template
180 - samba-testbase.tar.gz
182 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
183 # autobuild name, which means we can define a default template that runs most autobuild jobs
184 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
185 # On success we need to pack everything into an artifacts file
186 # which needs to be in the git checkout.
187 # As tar doesn't handle hardlink of read-only files,
188 # we remember the acls and add write permissions
189 # before creating the archive. The consumer will apply
191 - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
192 - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
193 - ln -s /tmp/samba-testbase/${AUTOBUILD_JOB_NAME}/ /tmp/samba-testbase/build_subdir_link
194 - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
195 - chmod -R +w /tmp/samba-testbase
196 - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
197 - tar cfz samba-testbase.tar.gz /tmp/samba-testbase
198 - ls -la samba-testbase.tar.gz
199 - sha1sum samba-testbase.tar.gz
201 .shared_template_test_only:
204 - .shared_runner_test
207 # We unpack the artifacts file created by the .shared_template_build_only
209 - ls -la samba-testbase.tar.gz
210 - sha1sum samba-testbase.tar.gz
211 - tar xfz samba-testbase.tar.gz -C /
212 - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
213 - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
214 - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
215 - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
216 - ls -la /tmp/samba-testbase/
217 - ls -la /tmp/samba-testbase/build_subdir_link
218 - ls -la /tmp/samba-testbase/build_subdir_link/
219 - 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
220 - ls -la /tmp/samba-testbase/build_subdir_link/
221 # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
222 # autobuild name, which means we can define a default template that runs most autobuild jobs
223 - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
226 extends: .shared_template_build_only
229 .needs_samba-def-build:
230 extends: .shared_template_test_only
232 - job: samba-def-build
236 extends: .shared_template_build_only
239 .needs_samba-mit-build:
240 extends: .shared_template_test_only
242 - job: samba-mit-build
246 extends: .shared_template_build_only
248 .needs_samba-h5l-build:
249 extends: .shared_template_test_only
251 - job: samba-h5l-build
255 extends: .shared_template_build_only
257 .needs_samba-nt4-build:
258 extends: .shared_template_test_only
260 - job: samba-nt4-build
263 samba-no-opath-build:
264 extends: .shared_template_build_only
266 .needs_samba-no-opath-build:
267 extends: .shared_template_test_only
269 - job: samba-no-opath-build
273 extends: .shared_template
276 extends: .shared_template
279 extends: .shared_template
282 extends: .shared_template
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: .needs_samba-def-build
300 extends: .needs_samba-def-build
303 extends: .needs_samba-def-build
306 extends: .needs_samba-def-build
309 extends: .needs_samba-def-build
312 extends: .needs_samba-def-build
315 extends: .shared_template
318 extends: .shared_template
320 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1604}
323 extends: .shared_template
326 extends: .shared_template
329 extends: .needs_samba-def-build
332 extends: .needs_samba-mit-build
334 samba-ad-dc-4a-mitkrb5:
335 extends: .needs_samba-mit-build
337 samba-ad-dc-4b-mitkrb5:
338 extends: .needs_samba-mit-build
340 # This task is run first to ensure we compile before we start the
341 # main run as it is the fastest full compile of Samba.
343 extends: .shared_template
345 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora34}
348 extends: .private_runner_test
352 # These jobs are only run if the gitlab repo has private runners available.
353 # To enable private jobs, you must add the following var and value to
354 # your gitlab repo by navigating to:
355 # settings -> CI/CD -> Environment variables
356 - $SUPPORT_PRIVATE_TEST == "yes"
358 .needs_samba-def-build-private:
360 - .needs_samba-def-build
363 .needs_samba-mit-build-private:
365 - .needs_samba-mit-build
368 .needs_samba-h5l-build-private:
370 - .needs_samba-h5l-build
373 .needs_samba-nt4-build-private:
375 - .needs_samba-nt4-build
378 .needs_samba-no-opath-build-private:
380 - .needs_samba-no-opath-build
384 extends: .needs_samba-h5l-build-private
387 extends: .needs_samba-def-build-private
390 extends: .needs_samba-nt4-build-private
392 samba-ad-dc-1-mitkrb5:
393 extends: .needs_samba-mit-build-private
396 extends: .needs_samba-no-opath-build-private
399 extends: .needs_samba-no-opath-build-private
401 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
403 extends: .shared_runner_build_image
405 dependencies: # tell gitlab to download artifacts for these jobs
424 - samba-ad-dc-4a-mitkrb5
425 - samba-ad-dc-4b-mitkrb5
431 - samba-schemaupgrade
432 - samba-ad-dc-1-mitkrb5
436 - ubuntu1804-samba-o3
439 - ./configure.developer
442 - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
444 - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
451 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
455 extends: .shared_runner_build_image
457 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora34}
460 - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
461 - tar xf /tmp/coverity_tool.tgz
462 - ./configure.developer --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc
463 - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
464 - tar czf cov-int.tar.gz cov-int
466 --form token=$COVERITY_SCAN_TOKEN
467 --form email=$COVERITY_SCAN_EMAIL
468 --form file=@cov-int.tar.gz
469 --form version="`git describe --tags`"
470 --form description="CI build"
471 https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
477 - $COVERITY_SCAN_TOKEN != null
478 - $COVERITY_SCAN_PROJECT_NAME != null
479 - $COVERITY_SCAN_EMAIL != null
487 # We build samba-o3 on all supported distributions
490 # This job, which matches the main CI, needs to still do coverage so
491 # we show the coverage on the "none" environment tests
493 # We want --enable-coverage specified here otherwise we will have a
494 # different set of build options on the coverage build and can fail
495 # when -O3 gets combined with --enable-coverage in the scheduled
499 extends: .shared_template
501 AUTOBUILD_JOB_NAME: samba-o3
502 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804}
503 SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: "--enable-coverage"
505 # All other jobs do not want code coverage.
507 extends: .shared_template
509 AUTOBUILD_JOB_NAME: samba-o3
512 # do not run o3 for coverage since they are using different images
513 - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
516 extends: .samba-o3-template
518 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu2004}
521 extends: .samba-o3-template
523 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_debian10}
525 opensuse151-samba-o3:
526 extends: .samba-o3-template
528 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse151}
530 opensuse152-samba-o3:
531 extends: .samba-o3-template
533 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_opensuse152}
536 extends: .samba-o3-template
538 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos7}
539 # Git on CentOS doesn't support shallow git cloning
541 # We need a newer GnuTLS version on CentOS7
542 PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
545 extends: .samba-o3-template
547 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_centos8}
550 extends: .samba-o3-template
552 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora33}
555 extends: .samba-o3-template
557 SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_fedora34}
560 # Keep the samba-o3 sections at the end ...