s3:smbd: disconnect the all client connections if a ctdb public ip dropped
[Samba.git] / bootstrap / .gitlab-ci.yml
blobd6cf02109fd0bb5b7c4f4254e3b114e1aa5ce113
1 services:
2   - docker:dind
4 .build_image_template:
5   image: docker:latest
6   stage: images
7   tags:
8     - docker
9     - gce
10   variables:
11     SAMBA_CI_IS_BROKEN_IMAGE: "no"
12     SAMBA_CI_TEST_JOB: "samba-o3"
13   before_script:
14     # Ensure we are generating correct the container
15     - uname -a
16     - cat /etc/os-release
17     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
18     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
19     - echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
20     - echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
21     - echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
22     - echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
23     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
24     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
25   script: |
26     set -xueo pipefail
27     ci_image_name=samba-ci-${CI_JOB_NAME}
28     docker build -t ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
29     ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
30     timestamp=$(date +%Y%m%d%H%M%S)
31     docker_hash=$(docker image inspect --format='{{index .Id}}' ${ci_image_name} | cut -d : -f 2 | cut -c 1-9)
32     timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${docker_hash}
33     samba_repo_root=/home/samba/samba
34     # Ensure we are generating the correct container that we expect to be in
35     echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
36     diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
37     docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
38         /bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt"
39     docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
40         diff -u bootstrap/sha1sum.txt /sha1sum.txt
41     docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
42         bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
43     diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
44     # run smoke test with samba-o3 or samba-fuzz
45     docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
46         /bin/bash -c "sudo chown -R samba:samba ./** && export PKG_CONFIG_PATH=/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig && script/autobuild.py ${SAMBA_CI_TEST_JOB} --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
47     docker tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
48     docker tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
49     # We build all images, but only upload is it's not marked as broken
50     test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
51         docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
52         docker push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
53         docker push ${ci_image_path}:${timestamp_tag}; \
54     }
55     echo "Success for ${ci_image_path}:${timestamp_tag}"
56     test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
57          echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
58          echo "Replace .build_image_template_force_broken with .build_image_template!"; \
59          echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
60          /bin/false; \
61     }
62   only:
63     variables:
64       #
65       # You need a custom pipeline which passes
66       # SAMBA_CI_REBUILD_IMAGES="yes".
67       #
68       # https://gitlab.com/samba-team/devel/samba/pipelines/new
69       #
70       - $SAMBA_CI_REBUILD_IMAGES == "yes"
72 .build_image_template_force_broken:
73   extends: .build_image_template
74   variables:
75     SAMBA_CI_IS_BROKEN_IMAGE: "yes"
76   only:
77     variables:
78       #
79       # You need a custom pipeline which passes
80       # SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
81       # in order to build broken images for debugging
82       #
83       # https://gitlab.com/samba-team/devel/samba/pipelines/new
84       #
85       - $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
87 # This is ONLY for oss-fuzz, so we test a fuzz build not a real one
88 ubuntu1604:
89   extends: .build_image_template
90   variables:
91     SAMBA_CI_TEST_JOB: "samba-fuzz"
93 ubuntu1804:
94   extends: .build_image_template
96 ubuntu2004:
97   extends: .build_image_template
99 debian10:
100   extends: .build_image_template
102 fedora31:
103   extends: .build_image_template
105 fedora32:
106   extends: .build_image_template
108 centos8:
109   extends: .build_image_template
111 centos7:
112   extends: .build_image_template
113   variables:
114     # Shallow copies are not supported by git on CentOS7
115     GIT_DEPTH: ""
116     # We install a compat-gnutls34 package for GnuTLS >= 3.4.7
117     PKG_CONFIG_PATH: /usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig
119 opensuse150:
120   extends: .build_image_template
122 opensuse151:
123   extends: .build_image_template