From 8bc51a6007b2398c0a6e519006eb395967e326d7 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 24 Mar 2014 19:23:30 +0000 Subject: [PATCH] Fetch tag refs from zuul in gerrit-git-prep * gerrit-git-prep.sh: If the zuul ref is a tag, then fetch the tag from zuul. Otherwise there's a risk that it may not have replicated to the origin yet when initially setting up the workspace. Change-Id: Iadd8385e4a0d0957fcac1cf89d0b5a1cfa848b49 --- .../files/slave_scripts/gerrit-git-prep.sh | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh index 2289db3db1..0fb422bb99 100755 --- a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh +++ b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh @@ -61,22 +61,24 @@ if ! git clean -x -f -d -q ; then git clean -x -f -d -q fi -if [ -z "$ZUUL_NEWREV" ] +if echo "$ZUUL_REF" | grep -q ^refs/tags/ +then + git fetch --tags $ZUUL_URL/$ZUUL_PROJECT $ZUUL_REF + git checkout $ZUUL_REF + git reset --hard $ZUUL_REF +elif [ -z "$ZUUL_NEWREV" ] then git fetch $ZUUL_URL/$ZUUL_PROJECT $ZUUL_REF git checkout FETCH_HEAD git reset --hard FETCH_HEAD - if ! git clean -x -f -d -q ; then - sleep 1 - git clean -x -f -d -q - fi else git checkout $ZUUL_NEWREV git reset --hard $ZUUL_NEWREV - if ! git clean -x -f -d -q ; then - sleep 1 - git clean -x -f -d -q - fi +fi + +if ! git clean -x -f -d -q ; then + sleep 1 + git clean -x -f -d -q fi if [ -f .gitmodules ]