-
Notifications
You must be signed in to change notification settings - Fork 3
/
clone.sh
47 lines (39 loc) · 1.79 KB
/
clone.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Checkout $GIT_SOURCE_DIR from git
. `dirname $0`/commons.sh
echo "Checking out and cleaning the $GIT_SOURCE_DIR"
if [ "$BUILDABLE_TARGET" == "" ] ; then
errExit "BUILDABLE_TARGET is empty"
fi
# BEGIN CODE CHECKOUT
if [ -d $GIT_SOURCE_DIR ] ; then
pushd $GIT_SOURCE_DIR
git fetch --all -t
git pull --tags || true
git reset --hard
git clean -fxd
if git rev-parse origin/$BUILDABLE_TARGET ; then osscommitid=`git checkout origin/$BUILDABLE_TARGET &>commit.log;cat commit.log; rm -f commit.log`
else osscommitid=`git checkout $BUILDABLE_TARGET &>commit.log;cat commit.log; rm -f commit.log` ; fi
popd
else
git clone ssh://hudson@git.cloud.com/var/lib/git/cloudstack-oss $GIT_SOURCE_DIR
#git clone https://github.com/CloudDotCom/CloudStack.git "$$GIT_SOURCE_DIR"
fi
if [ x"$NO_PROPIRETARY" != x"true" ]; then
pushd $GIT_SOURCE_DIR
if [ -d cloudstack-proprietary ] ; then
pushd cloudstack-proprietary
git fetch --all -t
git pull --tags || true
git reset --hard
git clean -fxd
if git rev-parse origin/$BUILDABLE_TARGET ; then premiumcommitid=`git checkout origin/$BUILDABLE_TARGET &>commit.log;cat commit.log; rm -f commit.log`
else premiumcommitid=`git checkout $BUILDABLE_TARGET &>commit.log;cat commit.log; rm -f commit.log` ; fi
popd
else
git clone ssh://hudson@git.lab.vmops.com/var/lib/git/cloudstack-proprietary
fi
popd
fi
# END CODE CHECKOUT
echo Build description: "$BUILD_USER; $BUILDABLE_TARGET -> $osscommitid / $premiumcommitid -> $DO_DISTRO_PACKAGES -> $PUSH_TO_REPO | Checkout: $BUILDABLE_TARGET -- resulting commit IDs: $osscommitid and $premiumcommitid -- distro packages: $DO_DISTRO_PACKAGES -- upload to repository: $PUSH_TO_REPO -- prerelease labels: $LABEL_AS_PRERELEASE"
exit 0