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