3 image: quay.io/podman/stable:latest
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
11 SAMBA_CI_IS_BROKEN_IMAGE: "no"
12 SAMBA_CI_TEST_JOB: "samba-o3"
13 SAMBA_CI_PLATFORM: "linux/amd64"
15 # install prerequisites
16 - dnf install -qy diffutils
17 # Ensure we are generating correct the container
20 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
21 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
22 - echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
23 - echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
24 - echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
25 - echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
26 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
27 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
30 ci_image_name=samba-ci-${CI_JOB_NAME}
31 podman build --platform ${SAMBA_CI_PLATFORM} --tag ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
32 ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
33 timestamp=$(date +%Y%m%d%H%M%S)
34 container_hash=$(podman image inspect --format='{{ .Id }}' ${ci_image_name} | cut -c 1-9)
35 timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${container_hash}
36 samba_repo_root=/home/samba/samba
37 # Ensure we are generating the correct container that we expect to be in
38 echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
39 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
40 podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
41 /bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt"
42 podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
43 diff -u bootstrap/sha1sum.txt /sha1sum.txt
44 podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
45 bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
46 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
47 # run smoke test with samba-o3 or samba-fuzz
48 podman run --volume $(pwd):/src:ro ${ci_image_name} \
49 /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"
50 podman tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
51 podman tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
52 # We build all images, but only upload is it's not marked as broken
53 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
54 podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
55 podman push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
56 podman push ${ci_image_path}:${timestamp_tag}; \
58 echo "Success for ${ci_image_path}:${timestamp_tag}"
59 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
60 echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
61 echo "Replace .build_image_template_force_broken with .build_image_template!"; \
62 echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
68 # You need a custom pipeline which passes
69 # SAMBA_CI_REBUILD_IMAGES="yes".
71 # https://gitlab.com/samba-team/devel/samba/pipelines/new
73 - $SAMBA_CI_REBUILD_IMAGES == "yes"
75 .build_image_template_force_broken:
76 extends: .build_image_template
78 SAMBA_CI_IS_BROKEN_IMAGE: "yes"
82 # You need a custom pipeline which passes
83 # SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
84 # in order to build broken images for debugging
86 # https://gitlab.com/samba-team/devel/samba/pipelines/new
88 - $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
91 extends: .build_image_template
94 extends: .build_image_template
97 extends: .build_image_template
100 extends: .build_image_template
103 extends: .build_image_template
106 extends: .build_image_template
108 SAMBA_CI_TEST_JOB: "samba-32bit"
109 SAMBA_CI_PLATFORM: "linux/i386"
112 extends: .build_image_template
115 extends: .build_image_template
118 extends: .build_image_template