11 SAMBA_CI_IS_BROKEN_IMAGE: "no"
13 # Ensure we are generating correct the container
16 - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
17 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
18 - echo "SAMBA_CI_IS_BROKEN_IMAGE[${SAMBA_CI_IS_BROKEN_IMAGE}]"
19 - echo "SAMBA_CI_REBUILD_IMAGES[${SAMBA_CI_REBUILD_IMAGES}]"
20 - echo "SAMBA_CI_REBUILD_BROKEN_IMAGES[${SAMBA_CI_REBUILD_BROKEN_IMAGES}]"
21 - echo "GITLAB_USER_LOGIN[${GITLAB_USER_LOGIN}]"
22 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
23 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
26 ci_image_name=samba-ci-${CI_JOB_NAME}
27 docker build -t ${ci_image_name} --build-arg SHA1SUM=${SAMBA_CI_CONTAINER_TAG} bootstrap/generated-dists/${CI_JOB_NAME}
28 ci_image_path="${SAMBA_CI_CONTAINER_REGISTRY}/${ci_image_name}"
29 timestamp=$(date +%Y%m%d%H%M%S)
30 docker_hash=$(docker image inspect --format='{{index .Id}}' ${ci_image_name} | cut -d : -f 2 | cut -c 1-9)
31 timestamp_tag=${SAMBA_CI_CONTAINER_TAG}-${timestamp}-${GITLAB_USER_LOGIN}-${docker_hash}
32 samba_repo_root=/home/samba/samba
33 # Ensure we are generating the correct container that we expect to be in
34 echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
35 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
36 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
37 /bin/bash -c "echo \"${SAMBA_CI_CONTAINER_TAG}\" > /tmp/sha1sum-tag.txt; diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt"
38 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
39 diff -u bootstrap/sha1sum.txt /sha1sum.txt
40 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
41 bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
42 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
43 # run smoke test with samba-o3
44 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
45 /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-o3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
46 docker tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
47 docker tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
48 # We build all images, but only upload is it's not marked as broken
49 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"yes" || { \
50 docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; \
51 docker push ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}; \
52 docker push ${ci_image_path}:${timestamp_tag}; \
54 echo "Success for ${ci_image_path}:${timestamp_tag}"
55 test x"${SAMBA_CI_IS_BROKEN_IMAGE}" = x"no" || { \
56 echo "The image ${CI_JOB_NAME} is marked as broken and should have failed!"; \
57 echo "Replace .build_image_template_force_broken with .build_image_template!"; \
58 echo "Add a .samba-o3-template section at the end of the main .gitlab-ci.yml!"; \
64 # You need a custom pipeline which passes
65 # SAMBA_CI_REBUILD_IMAGES="yes".
67 # https://gitlab.com/samba-team/devel/samba/pipelines/new
69 - $SAMBA_CI_REBUILD_IMAGES == "yes"
71 .build_image_template_force_broken:
72 extends: .build_image_template
74 SAMBA_CI_IS_BROKEN_IMAGE: "yes"
78 # You need a custom pipeline which passes
79 # SAMBA_CI_REBUILD_BROKEN_IMAGES="yes"
80 # in order to build broken images for debugging
82 # https://gitlab.com/samba-team/devel/samba/pipelines/new
84 - $SAMBA_CI_REBUILD_BROKEN_IMAGES == "yes"
87 extends: .build_image_template
90 extends: .build_image_template
93 extends: .build_image_template_force_broken
96 extends: .build_image_template
99 extends: .build_image_template_force_broken
102 extends: .build_image_template_force_broken
105 extends: .build_image_template
108 extends: .build_image_template
111 extends: .build_image_template
114 extends: .build_image_template
117 extends: .build_image_template
119 # Shallow copies are not supported by git on CentOS7
121 # We install a compat-gnutls34 package for GnuTLS >= 3.4.7
122 PKG_CONFIG_PATH: /usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig
125 extends: .build_image_template_force_broken
128 extends: .build_image_template
131 extends: .build_image_template