2022-11-16 11:37:16 +03:00
---
2019-03-14 07:15:47 +03:00
.build_image_template :
2022-05-23 20:42:55 +03:00
image : quay.io/podman/stable:latest
2019-03-14 07:15:47 +03:00
stage : images
tags :
2021-04-09 00:12:39 +03:00
# We need to make sure we only use gitlab.com
# runners and not our own runners, as our current runners
# don't allow 'docker build ...' to run.
2024-06-06 15:41:02 +03:00
- saas-linux-small-amd64
2019-03-14 07:15:47 +03:00
variables :
SAMBA_CI_IS_BROKEN_IMAGE : "no"
2020-03-17 06:49:02 +03:00
SAMBA_CI_TEST_JOB : "samba-o3"
2024-11-26 21:38:40 +03:00
SAMBA_CI_PLATFORM : "linux/amd64"
2019-03-14 07:15:47 +03:00
before_script :
2022-06-08 22:20:03 +03:00
# install prerequisites
- dnf install -qy diffutils
2019-03-14 07:15:47 +03:00
# Ensure we are generating correct the container
- uname -a
- cat /etc/os-release
- echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
- echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
- echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
- echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
- echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
- echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
- echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
- diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
script : |
set -xueo pipefail
ci_image_name=samba-ci-${CI_JOB_NAME}
2024-11-26 21:38:40 +03:00
podman build --platform ${SAMBA_CI_PLATFORM} --tag ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
2019-03-14 07:15:47 +03:00
ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
timestamp=$(date +%Y%m%d%H%M%S)
2022-05-23 20:42:55 +03:00
container_hash=$(podman image inspect --format='{{ .Id }}' ${ci_image_name} | cut -c 1-9)
timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${container_hash}
2019-03-14 07:15:47 +03:00
samba_repo_root=/home/samba/samba
# Ensure we are generating the correct container that we expect to be in
echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
2022-05-23 22:58:16 +03:00
podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
2019-03-14 07:15:47 +03:00
/bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt"
2022-05-23 22:58:16 +03:00
podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
2019-03-14 07:15:47 +03:00
diff -u bootstrap/sha1sum.txt /sha1sum.txt
2022-05-23 22:58:16 +03:00
podman run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
2019-03-14 07:15:47 +03:00
bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
2020-03-17 06:49:02 +03:00
# run smoke test with samba-o3 or samba-fuzz
2022-05-24 22:54:04 +03:00
podman run --volume $(pwd):/src:ro ${ci_image_name} \
2024-06-06 17:10:14 +03:00
/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"
2022-05-23 22:58:16 +03:00
podman tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
podman tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
2019-03-14 07:15:47 +03:00
# We build all images, but only upload is it's not marked as broken
test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
2022-05-23 22:58:16 +03:00
podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
podman push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
podman push ${ci_image_path}:${timestamp_tag}; \
2019-03-14 07:15:47 +03:00
}
echo "Success for ${ci_image_path}:${timestamp_tag}"
test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
echo "Replace .build_image_template_force_broken with .build_image_template!"; \
echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
/bin/false; \
}
only :
variables :
#
# You need a custom pipeline which passes
# SAMBA_CI_REBUILD_IMAGES="yes".
#
# https://gitlab.com/samba-team/devel/samba/pipelines/new
#
- $SAMBA_CI_REBUILD_IMAGES == "yes"
.build_image_template_force_broken :
extends : .build_image_template
variables :
SAMBA_CI_IS_BROKEN_IMAGE : "yes"
only :
variables :
#
# You need a custom pipeline which passes
# SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
# in order to build broken images for debugging
#
# https://gitlab.com/samba-team/devel/samba/pipelines/new
#
- $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
2020-03-26 00:17:46 +03:00
ubuntu2004 :
extends : .build_image_template
2022-11-02 18:56:31 +03:00
ubuntu2204 :
extends : .build_image_template
2021-10-14 06:50:41 +03:00
debian11 :
extends : .build_image_template
2022-11-17 18:14:27 +03:00
debian12 :
extends : .build_image_template
2024-11-20 17:43:13 +03:00
fedora41 :
2022-01-18 13:13:21 +03:00
extends : .build_image_template
2022-11-17 18:14:27 +03:00
debian11-32bit :
extends : .build_image_template
variables :
SAMBA_CI_TEST_JOB : "samba-32bit"
2024-11-26 21:38:40 +03:00
SAMBA_CI_PLATFORM : "linux/i386"
2022-11-17 18:14:27 +03:00
2024-08-27 18:32:43 +03:00
rocky8 :
2019-10-07 12:28:24 +03:00
extends : .build_image_template
2024-06-07 15:16:28 +03:00
centos9s :
extends : .build_image_template
2022-11-17 18:14:27 +03:00
opensuse155 :
2019-06-18 12:03:41 +03:00
extends : .build_image_template