vfs_fruit: Align a few integer types
[samba4-gss.git] / bootstrap / .gitlab-ci.yml
blobac2b4ebed09a6ebf3af593af0fc30fb669fb3c8e
1 ---
2 .build_image_template:
3   image: quay.io/podman/stable:latest
4   stage: images
5   tags:
6     # We need to make sure we only use gitlab.com
7     # runners and not our own runners, as our current runners
8     # don't allow 'docker build ...' to run.
9     - saas-linux-small-amd64
10   variables:
11     SAMBA_CI_IS_BROKEN_IMAGE: "no"
12     SAMBA_CI_TEST_JOB: "samba-o3"
13   before_script:
14     # install prerequisites
15     - dnf install -qy diffutils
16     # Ensure we are generating correct the container
17     - uname -a
18     - cat /etc/os-release
19     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
20     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
21     - echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
22     - echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
23     - echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
24     - echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
25     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
26     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
27   script: |
28     set -xueo pipefail
29     ci_image_name=samba-ci-${CI_JOB_NAME}
30     podman build -t ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
31     ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
32     timestamp=$(date +%Y%m%d%H%M%S)
33     container_hash=$(podman image inspect --format='{{ .Id }}' ${ci_image_name} | cut -c 1-9)
34     timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${container_hash}
35     samba_repo_root=/home/samba/samba
36     # Ensure we are generating the correct container that we expect to be in
37     echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
38     diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
39     podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
40         /bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt"
41     podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
42         diff -u bootstrap/sha1sum.txt /sha1sum.txt
43     podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
44         bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
45     diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
46     # run smoke test with samba-o3 or samba-fuzz
47     podman run --volume $(pwd):/src:ro ${ci_image_name} \
48         /bin/bash -c "git config --global --add safe.directory /src/.git && git clone /src samba && cd 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"
49     podman tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
50     podman tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
51     # We build all images, but only upload is it's not marked as broken
52     test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
53         podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
54         podman push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
55         podman push ${ci_image_path}:${timestamp_tag}; \
56     }
57     echo "Success for ${ci_image_path}:${timestamp_tag}"
58     test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
59          echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
60          echo "Replace .build_image_template_force_broken with .build_image_template!"; \
61          echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
62          /bin/false; \
63     }
64   only:
65     variables:
66       #
67       # You need a custom pipeline which passes
68       # SAMBA_CI_REBUILD_IMAGES="yes".
69       #
70       # https://gitlab.com/samba-team/devel/samba/pipelines/new
71       #
72       - $SAMBA_CI_REBUILD_IMAGES == "yes"
74 .build_image_template_force_broken:
75   extends: .build_image_template
76   variables:
77     SAMBA_CI_IS_BROKEN_IMAGE: "yes"
78   only:
79     variables:
80       #
81       # You need a custom pipeline which passes
82       # SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
83       # in order to build broken images for debugging
84       #
85       # https://gitlab.com/samba-team/devel/samba/pipelines/new
86       #
87       - $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
89 ubuntu2004:
90   extends: .build_image_template
92 ubuntu2204:
93   extends: .build_image_template
95 debian11:
96   extends: .build_image_template
98 debian12:
99   extends: .build_image_template
101 fedora40:
102   extends: .build_image_template
104 debian11-32bit:
105   extends: .build_image_template
106   variables:
107     SAMBA_CI_TEST_JOB: "samba-32bit"
109 rocky8:
110   extends: .build_image_template
112 centos9s:
113   extends: .build_image_template
115 opensuse155:
116   extends: .build_image_template