bootstrap: use runners with 'docker' and 'gce' tags for the image creation
[metze/samba-autobuild/.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: 8a3bbedea9514a337ed39d8c4e88abb17c43f975
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_fedora31: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora31:${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}
46
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'
51
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
100
101 others:
102   extends: .shared_template
103   script:
104     - script/autobuild.py ldb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
105     - script/autobuild.py pidl    $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
106     - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
107     - script/autobuild.py talloc  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
108     - script/autobuild.py tdb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
109     - script/autobuild.py tevent  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
110
111 samba:
112   extends: .shared_template
113
114 samba-mitkrb5:
115   extends: .shared_template
116
117 samba-none-env:
118   extends: .shared_template
119
120 samba-nopython:
121   extends: .shared_template
122
123 samba-nopython-py2:
124   extends: .shared_template
125
126 samba-xc:
127   extends: .shared_template
128
129 samba-admem:
130   extends: .shared_template
131
132 samba-ad-dc-2:
133   extends: .shared_template
134
135 samba-ad-dc-3:
136   extends: .shared_template
137
138 samba-ad-dc-4:
139   extends: .shared_template
140
141 samba-ad-dc-5:
142   extends: .shared_template
143
144 samba-ad-dc-6:
145   extends: .shared_template
146
147 samba-libs:
148   extends: .shared_template
149
150 samba-static:
151   extends: .shared_template
152
153 ctdb:
154   extends: .shared_template
155
156 samba-ctdb:
157   extends: .shared_template
158
159 samba-ad-dc-ntvfs:
160   extends: .shared_template
161
162 samba-admem-mit:
163   extends: .shared_template
164
165 samba-ad-dc-4-mitkrb5:
166   extends: .shared_template
167
168 .private_template:
169   extends: .shared_template
170   tags:
171     - docker
172     - samba-ci-private
173   only:
174     variables:
175       # These jobs are only run if the gitlab repo has private runners available.
176       # To enable private jobs, you must add the following var and value to
177       # your gitlab repo by navigating to:
178       # settings -> CI/CD -> Environment variables
179       - $SUPPORT_PRIVATE_TEST == "yes"
180
181 samba-ad-dc-backup:
182   extends: .private_template
183
184 samba-simpleserver:
185   extends: .private_template
186
187 samba-fileserver:
188   extends: .private_template
189
190 samba-ktest-heimdal:
191   extends: .private_template
192
193 samba-ad-dc-1:
194   extends: .private_template
195
196 samba-nt4:
197   extends: .private_template
198
199 samba-schemaupgrade:
200   extends: .private_template
201
202 samba-ad-dc-1-mitkrb5:
203   extends: .private_template
204
205 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
206 pages:
207   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
208   stage: report
209   tags:
210     - docker
211     - shared
212   dependencies:  # tell gitlab to download artifacts for these jobs
213     - samba
214     - samba-ad-dc-1
215     - samba-ad-dc-1-mitkrb5
216     - samba-ad-dc-2
217     - samba-ad-dc-3
218     - samba-ad-dc-4
219     - samba-ad-dc-4-mitkrb5
220     - samba-ad-dc-5
221     - samba-ad-dc-6
222     - samba-ad-dc-backup
223     - samba-ad-dc-ntvfs
224     - samba-admem
225     - samba-admem-mit
226     - samba-ctdb
227     - samba-fileserver
228     - samba-libs
229     - samba-none-env
230     - samba-nopython
231     - samba-nopython-py2
232     - samba-nt4
233     - samba-schemaupgrade
234     - samba-static
235     - samba-xc
236     # - ctdb  # TODO
237     - others
238   script:
239     - ./configure.developer
240     - make -j
241     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
242     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
243   artifacts:
244     expire_in: 30 days
245     paths:
246       - public
247   only:
248     variables:
249       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
250
251 #
252 # We build samba-o3 on all supported distributions
253 #
254
255 .samba-o3-template:
256   extends: .shared_template
257   variables:
258     AUTOBUILD_JOB_NAME: samba-o3
259   only:
260     variables:
261       # do not run o3 for coverage since they are using different images
262       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
263
264 ubuntu1804-samba-o3:
265   extends: .samba-o3-template
266   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
267
268 ubuntu1604-samba-o3:
269   extends: .samba-o3-template
270   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1604
271
272 debian9-samba-o3:
273   extends: .samba-o3-template
274   image: $SAMBA_CI_CONTAINER_IMAGE_debian9
275
276 opensuse150-samba-o3:
277   extends: .samba-o3-template
278   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
279
280 opensuse151-samba-o3:
281   extends: .samba-o3-template
282   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
283
284 centos7-samba-o3:
285   extends: .samba-o3-template
286   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
287   variables:
288     # Git on CentOS doesn't support shallow git cloning
289     GIT_DEPTH: ""
290     # We need a newer GnuTLS version on CentOS7
291     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
292
293 centos8-samba-o3:
294   extends: .samba-o3-template
295   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
296
297 fedora29-samba-o3:
298   extends: .samba-o3-template
299   image: $SAMBA_CI_CONTAINER_IMAGE_fedora29
300
301 fedora30-samba-o3:
302   extends: .samba-o3-template
303   image: $SAMBA_CI_CONTAINER_IMAGE_fedora30
304
305 fedora31-samba-o3:
306   extends: .samba-o3-template
307   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
308
309 #
310 # Keep the samba-o3 sections at the end ...
311 #