Get correct tag name when job is running in release pipeline

It is different to get the branch name and tag name in post and release
pipeline. With this patch, we can push tag registry tarballs.

Change-Id: Ifd1a3fe3da5548c340947946c27649a3059eb8b0
This commit is contained in:
Jeffrey Zhang 2017-03-20 21:54:37 +08:00
parent ac1d2df3b8
commit c282fa45fd

View File

@ -76,9 +76,15 @@ function collect_logs {
}
function pack_registry {
BRANCH=$(echo $ZUUL_REFNAME | cut -d/ -f2)
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-${BRANCH}.tar.gz
FILENAME=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${REF_NAME}.tar.gz
sudo docker stop registry
sudo tar -zcf "images/$FILENAME" -C /tmp/kolla_registry .
sudo docker start registry