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