11 # Ensure we are generating correct the container
14 - echo "SAMBA_CI_CONTAINER_REGISTRY_HOST[${SAMBA_CI_CONTAINER_REGISTRY_HOST}]"
15 - echo "SAMBA_CI_CONTAINER_REGISTRY_PATH[${SAMBA_CI_CONTAINER_REGISTRY_PATH}]"
16 - echo "SAMBA_CI_CONTAINER_IMAGE_DIST[${SAMBA_CI_CONTAINER_IMAGE_DIST}]"
17 - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
18 - echo "SAMBA_CI_CONTAINER_IMAGE[${SAMBA_CI_CONTAINER_IMAGE}]"
19 - echo "CI_REGISTRY_IMAGE[${CI_REGISTRY_IMAGE}]"
20 - echo "CI_REGISTRY_USER[${CI_REGISTRY_USER}]"
21 - echo "CI_REGISTRY[${CI_REGISTRY}]"
22 - echo "GIT_STRATEGY[${GIT_STRATEGY}]"
23 - echo "GIT_DEPTH[${GIT_DEPTH}]"
24 - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
25 - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
28 base_name=samba-ci-${CI_JOB_NAME}
29 sha1sum=$(cat bootstrap/sha1sum.txt)
30 docker build -t ${base_name} --build-arg SHA1SUM=${sha1sum} bootstrap/dists/${CI_JOB_NAME}
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} ${base_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} ${base_name} \
38 diff -u bootstrap/sha1sum.txt /sha1sum.txt
39 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
40 bootstrap/template.py --sha1sum --debug
41 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
42 /bin/bash -c "pwd;git clean -xdn ; git status; git log -1 ; git clean -xdf; git reset --hard HEAD; git status"
43 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
44 bootstrap/template.py --sha1sum --debug
45 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
46 bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
47 diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
48 # run smoke test with samba-o3
49 samba_repo_root=/home/samba/samba
50 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
51 /bin/bash -c "sudo chown -R samba:samba ./** && script/autobuild.py samba-o3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
52 docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${base_name} \
53 /bin/bash -c "pwd;git clean -xdn ; git status; git log -1 ; git clean -xdf; git reset --hard HEAD; git status";
54 full_name=${CI_REGISTRY_IMAGE}/${base_name}
55 timestamp=$(date +%Y%m%d%H%M%S)
56 hash=$(docker image inspect --format='{{index .Id}}' ${base_name} | cut -d : -f 2 | cut -c 1-9)
57 tag=${sha1sum}-${timestamp}-${hash}
58 docker tag ${base_name} ${full_name}:${tag}
59 docker tag ${base_name} ${full_name}:${sha1sum}
60 docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
61 docker push ${full_name}:${tag}
62 docker push ${full_name}:${sha1sum}
66 # # You need a custom pipeline which passes
67 # # SAMBA_CI_REBUILD_IMAGE="yes".
69 # # https://gitlab.com/samba-team/devel/samba/pipelines/new
71 # #- $SAMBA_CI_REBUILD_IMAGE == null
72 # - $SAMBA_CI_REBUILD_IMAGE == ""
73 # - $SAMBA_CI_REBUILD_IMAGE == "0"
74 # - $SAMBA_CI_REBUILD_IMAGE == "no"
78 # # In addition to SAMBA_CI_REBUILD_IMAGE="yes",
79 # # we only build the SAMBA_CI_CONTAINER_IMAGE_DIST
80 # # image (see ../.gitlab-ci.yml)
82 # # The 2nd "variables:" blocks forms an AND logic.
84 # # When you pass SAMBA_CI_REBUILD_ALL_IMAGES="yes"
85 # # all images are rebuild.
87 # # Only one of the two conditions below needs to be true
88 # # (They form an OR logic)
90 # - $SAMBA_CI_REBUILD_ALL_IMAGES == "yes"
91 # - $SAMBA_CI_CONTAINER_IMAGE_DIST == $CI_JOB_NAME
94 # current ci image is based on ubuntu1404
95 # we'll move to new ubuntu1404 image first
96 # then migrate to new ubuntu1804 next
97 # and make the other images pass ci later
100 extends: .job_template
103 extends: .job_template
106 extends: .job_template
109 extends: .job_template
112 extends: .job_template
115 extends: .job_template
118 extends: .job_template
121 extends: .job_template
124 extends: .job_template
127 extends: .job_template