ci-dockerfiles-sanity-check: new job
Job to verify if new dockerfiles build succeed/fail
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Change-Id: Id1405c19604a63af503dc268f5a86bd9fa086d70
diff --git a/ci-dockerfiles-deployment/publish.sh b/ci-dockerfiles-deployment/publish.sh
new file mode 100644
index 0000000..9d71f3e
--- /dev/null
+++ b/ci-dockerfiles-deployment/publish.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -ex
+
+trap cleanup_exit INT TERM EXIT
+
+cleanup_exit()
+{
+ rm -rf ${HOME}/.docker
+ rm -f ${WORKSPACE}/{log,config.json,version.txt}
+}
+
+docker_log_in()
+{
+ mkdir -p ${HOME}/.docker
+ sed -e "s|\${DOCKER_AUTH}|${DOCKER_AUTH}|" < ${WORKSPACE}/config.json > ${HOME}/.docker/config.json
+ chmod 0600 ${HOME}/.docker/config.json
+}
+
+update_images=$(find -type f -name .docker-tag)
+docker_log_in
+for imagename in ${update_images}; do
+ (
+ docker_tag=$(cat $imagename)
+ if [ x"${GERRIT_BRANCH}" != x"master" ]; then
+ new_tag=${docker_tag}-${GERRIT_BRANCH}
+ docker tag ${docker_tag} ${new_tag}
+ docker_tag=${new_tag}
+ fi
+ for i in 30 60 120;
+ do
+ docker push ${docker_tag} && exit 0 || true
+ sleep $i
+ docker_log_in
+ done
+ exit 1
+ )||echo $imagename push failed >> ${WORKSPACE}/log
+done
+
+if [ -e ${WORKSPACE}/log ]
+then
+ echo "some images failed:"
+ cat ${WORKSPACE}/log
+ exit 1
+fi