Clone from gerrit, fetch zuul refs from zuul.

Zuul may not always have the commits needed for some jobs,
and its branches may be in an unpredictable state, so only use
zuul to fetch zuul refs.

Re-set the origin to gerrit for any existing repos.

Change-Id: Ia300922d2e1585dd8d73a2711a7a25f4f9edd0e1
Reviewed-on: https://review.openstack.org/18492
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2012-12-20 08:51:34 -08:00 committed by Jenkins
parent 2bb68e8d61
commit 3ed03bbecb
2 changed files with 12 additions and 10 deletions

View File

@ -1,17 +1,17 @@
#!/bin/bash -e
REVIEW_SITE=$1
GIT_SITE=$2
GERRIT_SITE=$1
ZUUL_SITE=$2
if [ -z "$REVIEW_SITE" ]
if [ -z "$GERRIT_SITE" ]
then
echo "The git site name (eg 'https://review.openstack.org') must be the first argument."
echo "The gerrit site name (eg 'https://review.openstack.org') must be the first argument."
exit 1
fi
if [ -z "$GIT_SITE" ]
if [ -z "$ZUUL_SITE" ]
then
echo "The git site name (eg 'http://zuul.openstack.org') must be the second argument."
echo "The zuul site name (eg 'http://zuul.openstack.org') must be the second argument."
exit 1
fi
@ -23,21 +23,22 @@ fi
if [ ! -z "$ZUUL_CHANGE" ]
then
echo "Triggered by: $REVIEW_SITE/$ZUUL_CHANGE"
echo "Triggered by: $GERRIT_SITE/$ZUUL_CHANGE"
fi
set -x
if [[ ! -e .git ]]
then
git clone $GIT_SITE/p/$ZUUL_PROJECT .
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 $GIT_SITE/p/$ZUUL_PROJECT $ZUUL_REF
git fetch $ZUUL_SITE/p/$ZUUL_PROJECT $ZUUL_REF
git checkout FETCH_HEAD
git reset --hard FETCH_HEAD
git clean -x -f -d -q

View File

@ -109,9 +109,10 @@
- shell: |
#!/bin/bash -xe
if [[ ! -e devstack-gate ]]; then
git clone http://zuul.openstack.org/p/openstack-infra/devstack-gate
git clone https://review.openstack.org/p/openstack-infra/devstack-gate
else
cd devstack-gate
git remote set-url origin https://review.openstack.org/p/openstack-infra/devstack-gate
git remote update
git reset --hard
git clean -x -f