ctdb-daemon: Don't allow attach from recovery if recovery is not active
[samba.git] / .gitlab-ci.yml
blob06890ee9c99d05e0077e33348f28b3e5e941e6dc
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: 9061307e79ad13733c69352a965eeb4f44bef4b7
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_fedora31: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora31:${SAMBA_CI_CONTAINER_TAG}
43   SAMBA_CI_CONTAINER_IMAGE_fedora32: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora32:${SAMBA_CI_CONTAINER_TAG}
44   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
45   SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
47 include:
48   # The image creation details are specified in a separate file
49   # See bootstrap/README.md for details
50   - 'bootstrap/.gitlab-ci.yml'
52 .shared_template:
53   variables:
54     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
55   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
56   stage: build
57   tags:
58     - docker
59     - shared
60   before_script:
61     - uname -a
62     - lsb_release -a
63     - cat /etc/os-release
64     - mount
65     - df -h
66     - cat /proc/swaps
67     - free -h
68       # ld will fail if coverage enabled, force link ld to ld.bfd
69     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
70       # See bootstrap/.gitlab-ci.yml how to generate a new image
71     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
72     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
73     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
74     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
75     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
76     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
77     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
78   after_script:
79     - mount
80     - df -h
81     - cat /proc/swaps
82     - free -h
83   artifacts:
84     expire_in: 1 week
85     paths:
86       - "*.stdout"
87       - "*.stderr"
88       - "*.info"
89       - system-info.txt
90   retry:
91     max: 2
92     when:
93       - runner_system_failure
94       - stuck_or_timeout_failure
95   script:
96     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
97     # autobuild name, which means we can define a default template that runs most autobuild jobs
98     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
99     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
101 # Ensure when adding a new job below that you also add it to
102 # the dependencies for 'pages' below for the code coverage page
103 # generation.
105 others:
106   extends: .shared_template
107   script:
108     - script/autobuild.py ldb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
109     - script/autobuild.py pidl     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
110     - script/autobuild.py replace  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
111     - script/autobuild.py talloc   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
112     - script/autobuild.py tdb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
113     - script/autobuild.py tevent   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
114     - script/autobuild.py samba-xc $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-nopython:
123   extends: .shared_template
125 samba-nopython-py2:
126   extends: .shared_template
128 samba-admem:
129   extends: .shared_template
131 samba-ad-dc-2:
132   extends: .shared_template
134 samba-ad-dc-3:
135   extends: .shared_template
137 samba-ad-dc-4:
138   extends: .shared_template
140 samba-ad-dc-5:
141   extends: .shared_template
143 samba-ad-dc-6:
144   extends: .shared_template
146 samba-libs:
147   extends: .shared_template
149 samba-static:
150   extends: .shared_template
152 samba-fuzz:
153   extends: .shared_template
154   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
156 ctdb:
157   extends: .shared_template
159 samba-ctdb:
160   extends: .shared_template
162 samba-ad-dc-ntvfs:
163   extends: .shared_template
165 samba-admem-mit:
166   extends: .shared_template
168 samba-ad-dc-4-mitkrb5:
169   extends: .shared_template
171 .private_template:
172   extends: .shared_template
173   tags:
174     - docker
175     - samba-ci-private
176   only:
177     variables:
178       # These jobs are only run if the gitlab repo has private runners available.
179       # To enable private jobs, you must add the following var and value to
180       # your gitlab repo by navigating to:
181       # settings -> CI/CD -> Environment variables
182       - $SUPPORT_PRIVATE_TEST == "yes"
184 samba-ad-dc-backup:
185   extends: .private_template
187 samba-fileserver:
188   extends: .private_template
190 samba-ad-dc-1:
191   extends: .private_template
193 samba-nt4:
194   extends: .private_template
196 samba-schemaupgrade:
197   extends: .private_template
199 samba-ad-dc-1-mitkrb5:
200   extends: .private_template
202 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
203 pages:
204   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
205   stage: report
206   tags:
207     - docker
208     - shared
209   dependencies:  # tell gitlab to download artifacts for these jobs
210     - others
211     - samba
212     - samba-mitkrb5
213     - samba-nopython
214     - samba-nopython-py2
215     - samba-admem
216     - samba-ad-dc-2
217     - samba-ad-dc-3
218     - samba-ad-dc-4
219     - samba-ad-dc-5
220     - samba-ad-dc-6
221     - samba-libs
222     - samba-static
223     - samba-fuzz
224     # - ctdb  # TODO
225     - samba-ctdb
226     - samba-ad-dc-ntvfs
227     - samba-admem-mit
228     - samba-ad-dc-4-mitkrb5
229     - samba-ad-dc-backup
230     - samba-fileserver
231     - samba-ad-dc-1
232     - samba-nt4
233     - samba-schemaupgrade
234     - samba-ad-dc-1-mitkrb5
235   script:
236     - ./configure.developer
237     - make -j
238     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
239     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
240   artifacts:
241     expire_in: 30 days
242     paths:
243       - public
244   only:
245     variables:
246       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
249 # We build samba-o3 on all supported distributions
252 .samba-o3-template:
253   extends: .shared_template
254   variables:
255     AUTOBUILD_JOB_NAME: samba-o3
256   only:
257     variables:
258       # do not run o3 for coverage since they are using different images
259       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
261 ubuntu1804-samba-o3:
262   extends: .samba-o3-template
263   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
265 debian10-samba-o3:
266   extends: .samba-o3-template
267   image: $SAMBA_CI_CONTAINER_IMAGE_debian10
269 opensuse150-samba-o3:
270   extends: .samba-o3-template
271   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
273 opensuse151-samba-o3:
274   extends: .samba-o3-template
275   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
277 centos7-samba-o3:
278   extends: .samba-o3-template
279   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
280   variables:
281     # Git on CentOS doesn't support shallow git cloning
282     GIT_DEPTH: ""
283     # We need a newer GnuTLS version on CentOS7
284     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
286 centos8-samba-o3:
287   extends: .samba-o3-template
288   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
290 fedora31-samba-o3:
291   extends: .samba-o3-template
292   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
294 fedora32-samba-o3:
295   extends: .samba-o3-template
296   image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
299 # Keep the samba-o3 sections at the end ...