gitlab-ci: Add new runner for samba-admem-fips
[samba.git] / .gitlab-ci.yml
1 # see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
2
3 stages:
4   - images
5   - build
6   - analysis
7   - report
8
9 variables:
10   GIT_STRATEGY: fetch
11   GIT_DEPTH: "3"
12   # "--enable-coverage" or ""
13   SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: ""
14   #
15   # we run autobuild.py inside a samba CI docker image located on gitlab's registry
16   # overwrite this variable if you want use your own image registry.
17   #
18   # Or better ask for access to the shared development repository, see
19   # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
20   #
21   SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
22   #
23   # Set this to the contents of bootstrap/sha1sum.txt
24   # which is generated by bootstrap/template.py --render
25   #
26   SAMBA_CI_CONTAINER_TAG: c6ee634a9467e84ee8dd858b0b363f7a75973a66
27   #
28   # We use the ubuntu1804 image as default as
29   # it matches what we have on sn-devel-184.
30   #
31   SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
32   #
33   # The following images are available
34   # Please see the samba-o3 sections at the end of this file!
35   # We should run that for each available image
36   #
37   SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
38   SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
39   SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu2004:${SAMBA_CI_CONTAINER_TAG}
40   SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
41   SAMBA_CI_CONTAINER_IMAGE_debian10: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian10:${SAMBA_CI_CONTAINER_TAG}
42   SAMBA_CI_CONTAINER_IMAGE_opensuse150: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse150:${SAMBA_CI_CONTAINER_TAG}
43   SAMBA_CI_CONTAINER_IMAGE_opensuse151: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse151:${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_fedora32: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora32:${SAMBA_CI_CONTAINER_TAG}
46   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
47   SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
48
49 include:
50   # The image creation details are specified in a separate file
51   # See bootstrap/README.md for details
52   - 'bootstrap/.gitlab-ci.yml'
53
54 .shared_template:
55   variables:
56     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
57   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
58   stage: build
59   tags:
60     - docker
61     - shared
62   cache:
63     key: ccache.${CI_JOB_NAME}
64     paths:
65       - ccache
66   before_script:
67     - uname -a
68     - lsb_release -a
69     - cat /etc/os-release
70     - mount
71     - df -h
72     - cat /proc/swaps
73     - free -h
74       # ld will fail if coverage enabled, force link ld to ld.bfd
75     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
76       # See bootstrap/.gitlab-ci.yml how to generate a new image
77     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
78     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
79     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
80     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
81     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
82     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
83     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
84     - export CCACHE_BASEDIR="${PWD}"
85     - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
86     - export CC="ccache cc"
87     - export CXX="ccache c++"
88     - ccache -z -M 500M
89     - ccache -s
90   after_script:
91     - mount
92     - df -h
93     - cat /proc/swaps
94     - free -h
95     - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
96   artifacts:
97     expire_in: 1 week
98     paths:
99       - "*.stdout"
100       - "*.stderr"
101       - "*.info"
102       - system-info.txt
103   retry:
104     max: 2
105     when:
106       - runner_system_failure
107       - stuck_or_timeout_failure
108   script:
109     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
110     # autobuild name, which means we can define a default template that runs most autobuild jobs
111     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
112     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
113
114 # Ensure when adding a new job below that you also add it to
115 # the dependencies for 'pages' below for the code coverage page
116 # generation.
117
118 others:
119   extends: .shared_template
120   script:
121     - script/autobuild.py ldb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
122     - script/autobuild.py pidl     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
123     - script/autobuild.py replace  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
124     - script/autobuild.py talloc   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
125     - script/autobuild.py tdb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
126     - script/autobuild.py tevent   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
127     - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
128
129 samba:
130   extends: .shared_template
131
132 samba-mitkrb5:
133   extends: .shared_template
134
135 samba-nopython:
136   extends: .shared_template
137
138 samba-nopython-py2:
139   extends: .shared_template
140
141 samba-admem:
142   extends: .shared_template
143
144 samba-ad-dc-2:
145   extends: .shared_template
146
147 samba-ad-dc-3:
148   extends: .shared_template
149
150 samba-ad-dc-4:
151   extends: .shared_template
152
153 samba-ad-dc-5:
154   extends: .shared_template
155
156 samba-ad-dc-6:
157   extends: .shared_template
158
159 samba-libs:
160   extends: .shared_template
161
162 samba-static:
163   extends: .shared_template
164
165 samba-fuzz:
166   extends: .shared_template
167   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
168
169 ctdb:
170   extends: .shared_template
171
172 samba-ctdb:
173   extends: .shared_template
174
175 samba-ad-dc-ntvfs:
176   extends: .shared_template
177
178 samba-admem-mit:
179   extends: .shared_template
180
181 samba-ad-dc-4-mitkrb5:
182   extends: .shared_template
183
184 samba-ad-dc-fips:
185   extends: .shared_template
186   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
187
188 samba-admem-fips:
189   extends: .shared_template
190   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
191
192 .private_template:
193   extends: .shared_template
194   tags:
195     - docker
196     - samba-ci-private
197   only:
198     variables:
199       # These jobs are only run if the gitlab repo has private runners available.
200       # To enable private jobs, you must add the following var and value to
201       # your gitlab repo by navigating to:
202       # settings -> CI/CD -> Environment variables
203       - $SUPPORT_PRIVATE_TEST == "yes"
204
205 samba-ad-dc-backup:
206   extends: .private_template
207
208 samba-fileserver:
209   extends: .private_template
210
211 samba-ad-dc-1:
212   extends: .private_template
213
214 samba-nt4:
215   extends: .private_template
216
217 samba-schemaupgrade:
218   extends: .private_template
219
220 samba-ad-dc-1-mitkrb5:
221   extends: .private_template
222
223 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
224 pages:
225   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
226   stage: report
227   tags:
228     - docker
229     - shared
230   dependencies:  # tell gitlab to download artifacts for these jobs
231     - others
232     - samba
233     - samba-mitkrb5
234     - samba-nopython
235     - samba-nopython-py2
236     - samba-admem
237     - samba-ad-dc-2
238     - samba-ad-dc-3
239     - samba-ad-dc-4
240     - samba-ad-dc-5
241     - samba-ad-dc-6
242     - samba-libs
243     - samba-static
244     - samba-fuzz
245     # - ctdb  # TODO
246     - samba-ctdb
247     - samba-ad-dc-ntvfs
248     - samba-admem-mit
249     - samba-ad-dc-4-mitkrb5
250     - samba-ad-dc-backup
251     - samba-fileserver
252     - samba-ad-dc-1
253     - samba-nt4
254     - samba-schemaupgrade
255     - samba-ad-dc-1-mitkrb5
256     - samba-ad-dc-fips
257   script:
258     - ./configure.developer
259     - make -j
260     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
261     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
262   artifacts:
263     expire_in: 30 days
264     paths:
265       - public
266   only:
267     variables:
268       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
269
270 # Coverity Scan
271 coverity:
272   stage: analysis
273   image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
274   tags:
275     - docker
276     - shared
277   script:
278     - wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
279     - tar xf /tmp/coverity_tool.tgz
280     - ./configure.developer --with-system-mitkrb5 --with-experimental-mit-ad-dc
281     - cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
282     - tar czf cov-int.tar.gz cov-int
283     - curl
284       --form token=$COVERITY_SCAN_TOKEN
285       --form email=$COVERITY_SCAN_EMAIL
286       --form file=@cov-int.tar.gz
287       --form version="`git describe --tags`"
288       --form description="CI build"
289       https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
290   only:
291     refs:
292       - master
293       - schedules
294     variables:
295       - $COVERITY_SCAN_TOKEN != null
296       - $COVERITY_SCAN_PROJECT_NAME != null
297       - $COVERITY_SCAN_EMAIL != null
298   artifacts:
299     expire_in: 1 week
300     when: on_failure
301     paths:
302       - cov-int/*.txt
303
304 #
305 # We build samba-o3 on all supported distributions
306 #
307
308 .samba-o3-template:
309   extends: .shared_template
310   variables:
311     AUTOBUILD_JOB_NAME: samba-o3
312   only:
313     variables:
314       # do not run o3 for coverage since they are using different images
315       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
316
317 ubuntu1804-samba-o3:
318   extends: .samba-o3-template
319   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
320
321 ubuntu2004-samba-o3:
322   extends: .samba-o3-template
323   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu2004
324
325 debian10-samba-o3:
326   extends: .samba-o3-template
327   image: $SAMBA_CI_CONTAINER_IMAGE_debian10
328
329 opensuse150-samba-o3:
330   extends: .samba-o3-template
331   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
332
333 opensuse151-samba-o3:
334   extends: .samba-o3-template
335   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
336
337 centos7-samba-o3:
338   extends: .samba-o3-template
339   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
340   variables:
341     # Git on CentOS doesn't support shallow git cloning
342     GIT_DEPTH: ""
343     # We need a newer GnuTLS version on CentOS7
344     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
345
346 centos8-samba-o3:
347   extends: .samba-o3-template
348   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
349
350 fedora31-samba-o3:
351   extends: .samba-o3-template
352   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
353
354 fedora32-samba-o3:
355   extends: .samba-o3-template
356   image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
357
358 #
359 # Keep the samba-o3 sections at the end ...
360 #