aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal (inc0) Jastrzebski <inc007@gmail.com>2017-06-19 10:32:35 -0700
committerMichal (inc0) Jastrzebski <inc007@gmail.com>2017-07-18 15:03:06 -0700
commit1cdc18211a889144cb139e98871c56098939c307 (patch)
treea59da61e0916f92f60d6fdc8f0b2d198dac65da1
parentf8c03e5c199a7ced58c01bc7ae1bec6b8c9c9562 (diff)
downloadkolla-1cdc18211a889144cb139e98871c56098939c307.tar.gz
kolla-1cdc18211a889144cb139e98871c56098939c307.zip
Dockerfile publishing pipeline
We now have experimental gates which will eventually be daily jobs to build, test and publish images to dockerhub. First step is to mimic our tarball publisher to build images -> save them to temp space -> run set of jobs that will sign off these images -> move images to regular tarballs. Depends-on: I0231bd07415ef05b3f4f937e32a9df4cd0643672 Change-Id: If578edcd4e431c0b93cb9cedcc3d9db47d41a637
-rwxr-xr-xtools/gate_run.sh10
-rwxr-xr-xtools/publisher.sh64
2 files changed, 66 insertions, 8 deletions
diff --git a/tools/gate_run.sh b/tools/gate_run.sh
index 1a58f5605..526893d37 100755
--- a/tools/gate_run.sh
+++ b/tools/gate_run.sh
@@ -76,15 +76,9 @@ function collect_logs {
}
function pack_registry {
- if [[ "$ZUUL_PIPELINE" == "tag" ]]; then
- # ZUUL_REFNAME=refs/tags/4.0.0
- REF_NAME=$(echo $ZUUL_REFNAME | cut -d/ -f3)
- else
- # ZUUL_REFNAME=stable/ocata or master
- REF_NAME=$(echo $ZUUL_REFNAME | cut -d/ -f2)
- fi
sudo mkdir "images"
- FILENAME=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${REF_NAME}.tar.gz
+ BRANCH=$(echo "$ZUUL_BRANCH" | cut -d/ -f2)
+ FILENAME=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar.gz
sudo docker stop registry
sudo tar -zcf "images/$FILENAME" -C /tmp/kolla_registry .
sudo docker start registry
diff --git a/tools/publisher.sh b/tools/publisher.sh
new file mode 100755
index 000000000..fa06563ae
--- /dev/null
+++ b/tools/publisher.sh
@@ -0,0 +1,64 @@
+# Script which is run in dockerhub publisher pipeline
+# It will organize build/deploy gates and then publish images to final place
+
+export ZUUL_REF=$ZUUL_REF
+export BRANCH=$(echo "$ZUUL_BRANCH" | cut -d/ -f2)
+export TMP_REGISTRY="tmp/"
+export PUBLISHER=1
+export SIGNOFF_FILENAME=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.txt
+export FILENAME=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar.gz
+
+# Ansible deployment gate to test out images
+function deploy_ansible {
+ export KOLLA_ANSIBLE_DIR=$(mktemp -d)
+ cat > /tmp/clonemap <<EOF
+clonemap:
+ - name: openstack/kolla-ansible
+ dest: ${KOLLA_ANSIBLE_DIR}
+EOF
+
+ /usr/zuul-env/bin/zuul-cloner -m /tmp/clonemap --workspace "$(pwd)" \
+ --cache-dir /opt/git git://git.openstack.org openstack/kolla-ansible
+
+ pushd "${KOLLA_ANSIBLE_DIR}"
+ tools/setup_gate.sh
+ popd
+}
+
+# If test passes, add link to test data which later will be added to image
+function signoff {
+ mkdir -p images/
+ curl -o images/$SIGNOFF_FILENAME http://tarballs.openstack.org/kolla/images/tmp/$SIGNOFF_FILENAME
+ echo http://logs.openstack.org/$LOG_PATH >> images/$SIGNOFF_FILENAME
+}
+
+# Building images that are supposed to be tested later
+if [[ $ACTION == "build" ]]; then
+ tools/gate_run.sh
+ sudo touch images/$SIGNOFF_FILENAME
+ sudo chmod 777 images/$SIGNOFF_FILENAME
+
+ echo http://logs.openstack.org/$LOG_PATH >> images/$SIGNOFF_FILENAME
+ exit 0
+fi
+if [[ $ACTION == "deploy-multinode" ]]; then
+ if [[ $ORCH_ENGINE == "ansible" ]]; then
+ deploy_ansible
+ signoff
+ exit 0
+ fi
+fi
+
+# After all tests pass, move images from temp to final dir on tarballs.o.o
+if [[ $ACTION == "save" ]]; then
+ mkdir -p images/
+ wget -q -c -O "/tmp/$FILENAME" \
+ "http://tarballs.openstack.org/kolla/images/tmp/$FILENAME"
+ curl -o /tmp/$SIGNOFF_FILENAME http://tarballs.openstack.org/kolla/images/tmp/$SIGNOFF_FILENAME
+ gunzip /tmp/$FILENAME
+ tar -rf /tmp/${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar /tmp/$SIGNOFF_FILENAME
+ gzip /tmp/${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar
+ ls -la /tmp/
+ sudo mv /tmp/$FILENAME images/publisher-$FILENAME
+fi
+