system-config/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh
Clark Boylan 733fd110e4 Revert "Add git fetch --tags to gerrit-git-prep.sh."
This reverts commit dbe5f35a5a.

Git fetch operations are time consuming on our Centos6 slaves. The
additional fetch for the tags is nice to have but not necessary in most
cases. Remove it to reduce time spent doing this on the Centos6 slaves.

Change-Id: If2ca089df660b6dda1fb6381a8ea5a2ef6e5304f
Reviewed-on: https://review.openstack.org/36544
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
2013-07-10 21:54:50 +00:00

50 lines
1008 B
Bash
Executable File

#!/bin/bash -e
GERRIT_SITE=$1
ZUUL_SITE=$2
if [ -z "$GERRIT_SITE" ]
then
echo "The gerrit site name (eg 'https://review.openstack.org') must be the first argument."
exit 1
fi
if [ -z "$ZUUL_SITE" ]
then
echo "The zuul site name (eg 'http://zuul.openstack.org') must be the second argument."
exit 1
fi
if [ -z "$ZUUL_REF" ]
then
echo "This job may only be triggered by Zuul."
exit 1
fi
if [ ! -z "$ZUUL_CHANGE" ]
then
echo "Triggered by: $GERRIT_SITE/$ZUUL_CHANGE"
fi
set -x
if [[ ! -e .git ]]
then
git clone $GERRIT_SITE/p/$ZUUL_PROJECT .
fi
git remote set-url origin $GERRIT_SITE/p/$ZUUL_PROJECT
git remote update || git remote update # attempt to work around bug #925790
git reset --hard
git clean -x -f -d -q
if [ -z "$ZUUL_NEWREV" ]
then
git fetch $ZUUL_SITE/p/$ZUUL_PROJECT $ZUUL_REF
git checkout FETCH_HEAD
git reset --hard FETCH_HEAD
git clean -x -f -d -q
else
git checkout $ZUUL_NEWREV
git reset --hard $ZUUL_NEWREV
git clean -x -f -d -q
fi