VERSION: Disable GIT_SNAPSHOT for the Samba 4.12.13 release.
[Samba.git] / .gitlab-ci.yml
blobc706dac66bd39f6d8534d7ecebd81c54002e3204
1 # see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
3 stages:
4   - images
5   - build
6   - report
8 variables:
9   GIT_STRATEGY: fetch
10   GIT_DEPTH: "3"
11   # "--enable-coverage" or ""
12   SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: ""
13   #
14   # we run autobuild.py inside a samba CI docker image located on gitlab's registry
15   # overwrite this variable if you want use your own image registry.
16   #
17   # Or better ask for access to the shared development repository, see
18   # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
19   #
20   SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
21   #
22   # Set this to the contents of bootstrap/sha1sum.txt
23   # which is generated by bootstrap/template.py --render
24   #
25   SAMBA_CI_CONTAINER_TAG: 8bec130a6b741608616302662edee02fd39f3baf
26   #
27   # We use the ubuntu1804 image as default as
28   # it matches what we have on sn-devel-184.
29   #
30   SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
31   #
32   # The following images are available
33   # Please see the samba-o3 sections at the end of this file!
34   # We should run that for each available image
35   #
36   SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
37   SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
38   SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
39   SAMBA_CI_CONTAINER_IMAGE_debian10: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian10:${SAMBA_CI_CONTAINER_TAG}
40   SAMBA_CI_CONTAINER_IMAGE_opensuse150: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse150:${SAMBA_CI_CONTAINER_TAG}
41   SAMBA_CI_CONTAINER_IMAGE_opensuse151: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse151:${SAMBA_CI_CONTAINER_TAG}
42   SAMBA_CI_CONTAINER_IMAGE_fedora29: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora29:${SAMBA_CI_CONTAINER_TAG}
43   SAMBA_CI_CONTAINER_IMAGE_fedora30: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora30:${SAMBA_CI_CONTAINER_TAG}
44   SAMBA_CI_CONTAINER_IMAGE_fedora31: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora31:${SAMBA_CI_CONTAINER_TAG}
45   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
46   SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
48 include:
49   # The image creation details are specified in a separate file
50   # See bootstrap/README.md for details
51   - 'bootstrap/.gitlab-ci.yml'
53 .shared_template:
54   variables:
55     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
56   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
57   stage: build
58   tags:
59     - docker
60     - shared
61   before_script:
62     - uname -a
63     - lsb_release -a
64     - cat /etc/os-release
65     - mount
66     - df -h
67     - cat /proc/swaps
68     - free -h
69       # ld will fail if coverage enabled, force link ld to ld.bfd
70     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
71       # See bootstrap/.gitlab-ci.yml how to generate a new image
72     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
73     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
74     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
75     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
76     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
77     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
78     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
79   after_script:
80     - mount
81     - df -h
82     - cat /proc/swaps
83     - free -h
84   artifacts:
85     expire_in: 1 week
86     paths:
87       - "*.stdout"
88       - "*.stderr"
89       - "*.info"
90       - system-info.txt
91   retry:
92     max: 2
93     when:
94       - runner_system_failure
95       - stuck_or_timeout_failure
96   script:
97     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
98     # autobuild name, which means we can define a default template that runs most autobuild jobs
99     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
100     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
102 # Ensure when adding a new job below that you also add it to
103 # the dependencies for 'pages' below for the code coverage page
104 # generation.
106 others:
107   extends: .shared_template
108   script:
109     - script/autobuild.py ldb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
110     - script/autobuild.py pidl    $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
111     - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
112     - script/autobuild.py talloc  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
113     - script/autobuild.py tdb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
114     - script/autobuild.py tevent  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
116 samba:
117   extends: .shared_template
119 samba-mitkrb5:
120   extends: .shared_template
122 samba-none-env:
123   extends: .shared_template
125 samba-nopython:
126   extends: .shared_template
128 samba-nopython-py2:
129   extends: .shared_template
131 samba-xc:
132   extends: .shared_template
134 samba-admem:
135   extends: .shared_template
137 samba-ad-dc-2:
138   extends: .shared_template
140 samba-ad-dc-3:
141   extends: .shared_template
143 samba-ad-dc-4:
144   extends: .shared_template
146 samba-ad-dc-5:
147   extends: .shared_template
149 samba-ad-dc-6:
150   extends: .shared_template
152 samba-libs:
153   extends: .shared_template
155 samba-static:
156   extends: .shared_template
158 samba-fuzz:
159   extends: .shared_template
161 ctdb:
162   extends: .shared_template
164 samba-ctdb:
165   extends: .shared_template
167 samba-ad-dc-ntvfs:
168   extends: .shared_template
170 samba-admem-mit:
171   extends: .shared_template
173 samba-ad-dc-4-mitkrb5:
174   extends: .shared_template
176 .private_template:
177   extends: .shared_template
178   tags:
179     - docker
180     - samba-ci-private
181   only:
182     variables:
183       # These jobs are only run if the gitlab repo has private runners available.
184       # To enable private jobs, you must add the following var and value to
185       # your gitlab repo by navigating to:
186       # settings -> CI/CD -> Environment variables
187       - $SUPPORT_PRIVATE_TEST == "yes"
189 samba-ad-dc-backup:
190   extends: .private_template
192 samba-simpleserver:
193   extends: .private_template
195 samba-fileserver:
196   extends: .private_template
198 samba-ktest-heimdal:
199   extends: .private_template
201 samba-ad-dc-1:
202   extends: .private_template
204 samba-nt4:
205   extends: .private_template
207 samba-schemaupgrade:
208   extends: .private_template
210 samba-ad-dc-1-mitkrb5:
211   extends: .private_template
213 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
214 pages:
215   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
216   stage: report
217   tags:
218     - docker
219     - shared
220   dependencies:  # tell gitlab to download artifacts for these jobs
221     - others
222     - samba
223     - samba-mitkrb5
224     - samba-none-env
225     - samba-nopython
226     - samba-nopython-py2
227     - samba-xc
228     - samba-admem
229     - samba-ad-dc-2
230     - samba-ad-dc-3
231     - samba-ad-dc-4
232     - samba-ad-dc-5
233     - samba-ad-dc-6
234     - samba-libs
235     - samba-static
236     - samba-fuzz
237     # - ctdb  # TODO
238     - samba-ctdb
239     - samba-ad-dc-ntvfs
240     - samba-admem-mit
241     - samba-ad-dc-4-mitkrb5
242     - samba-ad-dc-backup
243     - samba-simpleserver
244     - samba-fileserver
245     - samba-ktest-heimdal
246     - samba-ad-dc-1
247     - samba-nt4
248     - samba-schemaupgrade
249     - samba-ad-dc-1-mitkrb5
250   script:
251     - ./configure.developer
252     - make -j
253     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
254     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
255   artifacts:
256     expire_in: 30 days
257     paths:
258       - public
259   only:
260     variables:
261       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
264 # We build samba-o3 on all supported distributions
267 .samba-o3-template:
268   extends: .shared_template
269   variables:
270     AUTOBUILD_JOB_NAME: samba-o3
271   only:
272     variables:
273       # do not run o3 for coverage since they are using different images
274       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
276 ubuntu1804-samba-o3:
277   extends: .samba-o3-template
278   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
280 ubuntu1604-samba-o3:
281   extends: .samba-o3-template
282   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1604
284 debian9-samba-o3:
285   extends: .samba-o3-template
286   image: $SAMBA_CI_CONTAINER_IMAGE_debian9
288 debian10-samba-o3:
289   extends: .samba-o3-template
290   image: $SAMBA_CI_CONTAINER_IMAGE_debian10
292 opensuse150-samba-o3:
293   extends: .samba-o3-template
294   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
296 opensuse151-samba-o3:
297   extends: .samba-o3-template
298   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
300 centos7-samba-o3:
301   extends: .samba-o3-template
302   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
303   variables:
304     # Git on CentOS doesn't support shallow git cloning
305     GIT_DEPTH: ""
306     # We need a newer GnuTLS version on CentOS7
307     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
309 centos8-samba-o3:
310   extends: .samba-o3-template
311   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
313 fedora29-samba-o3:
314   extends: .samba-o3-template
315   image: $SAMBA_CI_CONTAINER_IMAGE_fedora29
317 fedora30-samba-o3:
318   extends: .samba-o3-template
319   image: $SAMBA_CI_CONTAINER_IMAGE_fedora30
321 fedora31-samba-o3:
322   extends: .samba-o3-template
323   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
326 # Keep the samba-o3 sections at the end ...