10 SAMBA_CI_IS_BROKEN_IMAGE: "no"
12 # Ensure we are generating correct the container
15 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
16 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
17 - echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
18 - echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
19 - echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
20 - echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
21 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
22 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
25 ci_image_name=samba-ci-${CI_JOB_NAME}
26 docker build -t ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
27 ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
28 timestamp=$(date +%Y%m%d%H%M%S)
29 docker_hash=$(docker image inspect --format='{{index .Id}}' ${ci_image_name} | cut -d : -f 2 | cut -c 1-9)
30 timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${docker_hash}
31 samba_repo_root=/home/samba/samba
32 # Ensure we are generating the correct container that we expect to be in
33 echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
34 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
35 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
36 /bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; 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 diff -u bootstrap/sha1sum.txt /sha1sum.txt
39 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
40 bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
41 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
42 # run smoke test with samba-o3
43 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
44 /bin/bash -c "sudo chown -R samba:samba ./** && script/autobuild.py samba-o3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
45 docker tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
46 docker tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
47 # We build all images, but only upload is it's not marked as broken
48 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
49 docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
50 docker push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
51 docker push ${ci_image_path}:${timestamp_tag}; \
53 echo "Success for ${ci_image_path}:${timestamp_tag}"
54 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
55 echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
56 echo "Replace .build_image_template_force_broken with .build_image_template!"; \
57 echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
63 # You need a custom pipeline which passes
64 # SAMBA_CI_REBUILD_IMAGES="yes".
66 # https://gitlab.com/samba-team/devel/samba/pipelines/new
68 - $SAMBA_CI_REBUILD_IMAGES == "yes"
70 .build_image_template_force_broken:
71 extends: .build_image_template
73 SAMBA_CI_IS_BROKEN_IMAGE: "yes"
77 # You need a custom pipeline which passes
78 # SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
79 # in order to build broken images for debugging
81 # https://gitlab.com/samba-team/devel/samba/pipelines/new
83 - $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
86 extends: .build_image_template
89 extends: .build_image_template
92 extends: .build_image_template
95 extends: .build_image_template
98 extends: .build_image_template_force_broken
101 extends: .build_image_template_force_broken
104 extends: .build_image_template_force_broken
107 extends: .build_image_template_force_broken
110 extends: .build_image_template_force_broken
113 extends: .build_image_template_force_broken
116 extends: .build_image_template