-#Adding OpenStack packages to undercloud
-pushd images > /dev/null
-
-# Use apex tripleo-heat-templates fork
-PR_NUMBER=""
-REF="stable/colorado"
-REPO="https://github.com/trozet/opnfv-tht"
-
-if git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*'; then
- PR_NUMBER=$(git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*')
-fi
-
-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=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['merged']")
- if [ "$MERGED" == "False" ]; then
- REF=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['ref']")
- echo "Setting GitHub Ref to: $REF"
- REPO=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['repo']['clone_url']")
- echo "Setting GitHub URL to: $REPO"
- fi
-fi
-
-rm -rf opnfv-tht
-git clone $REPO -b $REF opnfv-tht
-