diff options
author | Michael Chapman <woppin@gmail.com> | 2016-04-06 05:40:15 +1000 |
---|---|---|
committer | Michael Chapman <woppin@gmail.com> | 2016-04-12 14:21:17 +1000 |
commit | 531e440adbda718f934ad0932cbb8483a419072e (patch) | |
tree | 9e1796f525e3e0e0a1c44e9e9be3d55b26154f26 | |
parent | 8a68db21c4780ac22ffe61b27779c9fd729edc4b (diff) |
Get tht from github instead of rpm
Use apex fork of tht instead of relying on rpms. Can get specific
pull requests instead of default branch if specified in the commit
message using the syntax:
opnfv-tht-pr: [pull-request-number]
Change-Id: Ib4c8edd1a94258406d06dd7e80b4ae4ec8ca6c53
Signed-off-by: Tim Rozet <trozet@redhat.com>
-rwxr-xr-x | build/undercloud.sh | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/build/undercloud.sh b/build/undercloud.sh index f39ee73f..ca75bb0e 100755 --- a/build/undercloud.sh +++ b/build/undercloud.sh @@ -30,9 +30,39 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --upload ../opnfv-environment.yaml:/home/stack/ \ -a undercloud.qcow2 -# Patch in OpenDaylight installation and configuration -#LIBGUESTFS_BACKEND=direct virt-customize --upload ../opnfv-tripleo-heat-templates.patch:/tmp \ -# --run-command "cd /usr/share/openstack-tripleo-heat-templates/ && patch -Np1 < /tmp/opnfv-tripleo-heat-templates.patch" \ -# -a undercloud.qcow2 +# Use apex tripleo-heat-templates fork +PR_NUMBER=$(git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*') +REF="stable/colorado" +REPO="https://github.com/trozet/opnfv-tht" + +if [ "$PR_NUMBER" != "" ]; then + echo "Using pull request $PR_NUMBER from $REPO" + # Source credentials since we are rate limited to 60/day + GHCREDS="" + if [ -f ~/.githubcreds ]; then + source ~/.githubcreds + GHCREDS=" -u $GHUSERNAME:$GHACCESSTOKEN" + fi + + PR=$(curl $GHCREDS https://api.github.com/repos/trozet/opnfv-tht/pulls/$PR_NUMBER) + + # Do not pull from merged branches + MERGED=$(echo $PR | python -c "import sys,json; print json.load(sys.stdin)['head']['merged']") + if [ "$MERGED" == false ]; then + REF=$(echo $PR | python -c "import sys,json; print json.load(sys.stdin)['head']['ref']") + REPO=$(echo $PR | python -c "import sys,json; print json.load(sys.stdin)['head']['repo']['git_url']") + fi +fi + +rm -rf opnfv-tht +git clone $REPO -b $REF opnfv-tht + +pushd opnfv-tht > /dev/null +git archive --format=tar.gz --prefix=openstack-tripleo-heat-templates/ HEAD > ../opnfv-tht.tar.gz +popd > /dev/null +LIBGUESTFS_BACKEND=direct virt-customize --upload opnfv-tht.tar.gz:/usr/share \ + --run-command "cd /usr/share && rm -rf openstack-tripleo-heat-templates && tar xzf opnfv-tht.tar.gz" \ + -a undercloud.qcow2 + popd > /dev/null |