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