summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Radez <dradez@redhat.com>2016-06-13 14:56:16 -0400
committerDan Radez <dradez@redhat.com>2016-06-13 20:29:19 -0400
commitaf2f93cebc62cd0d6f7c4b1a74fdeb65fbcf90a8 (patch)
tree7602423433ca36535dfbd2e3b2114d8c4be5ce57
parent61c08699e3cdfec36633ae869fddbc4f22c32244 (diff)
puppet-tripleo fork integration
moving the github integration with pull requests into a function so we can continue to service opnfv-tht and also service opnfv-puppet-tripleo with the same code opnfv-puppet-tripleo-pr: 3 Change-Id: Ief2b1e7309defce9ed2029f6baade3c1371b7d96 Signed-off-by: Dan Radez <dradez@redhat.com>
-rw-r--r--build/cache.sh4
-rw-r--r--build/functions.sh46
-rwxr-xr-xbuild/overcloud-full.sh11
-rwxr-xr-xbuild/undercloud.sh49
4 files changed, 69 insertions, 41 deletions
diff --git a/build/cache.sh b/build/cache.sh
index a88ffce1..123748a2 100644
--- a/build/cache.sh
+++ b/build/cache.sh
@@ -24,6 +24,10 @@ function cache_git_tar {
# $1 = download url
# $2 = filename to write to
function curl_file {
+ if [ -f $CACHE_DIR/$2 ]; then
+ echo "Removing stale $2"
+ rm -f $CACHE_DIR/$2
+ fi
echo "Downloading $1"
echo "Cache download location: $CACHE_DIR/$2"
until curl -C- -L -o $CACHE_DIR/$2 $1 || (( count++ >= 20 )); do
diff --git a/build/functions.sh b/build/functions.sh
new file mode 100644
index 00000000..e61102ef
--- /dev/null
+++ b/build/functions.sh
@@ -0,0 +1,46 @@
+##############################################################################
+# Copyright (c) 2016 Dan Radez (Red Hat) and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+clone_fork () {
+ # ARG 1: opnfv-tht or opnfv-python-triplo
+ echo "Cloning $1"
+
+ # Use apex tripleo-heat-templates fork
+ local ghcreds=""
+ local pr_num=""
+ local ref="stable/colorado"
+ local repo="https://github.com/trozet/$1"
+
+ if git log -1 | grep "${1}-pr:" | grep -o '[0-9]*'; then
+ pr_num=$(git log -1 | grep "${1}-pr:" | grep -o '[0-9]*')
+ fi
+
+ if [ "$pr_num" != "" ]; then
+ echo "Using pull request $pr_num from $repo"
+ # Source credentials since we are rate limited to 60/day
+ if [ -f ~/.githubcreds ]; then
+ source ~/.githubcreds
+ ghcreds=" -u $GHUSERNAME:$GHACCESSTOKEN"
+ fi
+
+ PR=$(curl $ghcreds https://api.github.com/repos/trozet/$1/pulls/$pr_num)
+
+ # 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 $1
+ git clone $repo -b $ref $1
+}
diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh
index af978edb..fe67c287 100755
--- a/build/overcloud-full.sh
+++ b/build/overcloud-full.sh
@@ -10,6 +10,7 @@
set -e
source ./cache.sh
source ./variables.sh
+source ./functions.sh
populate_cache "$rdo_images_uri/overcloud-full.tar"
@@ -21,6 +22,12 @@ mv -f images/overcloud-full.qcow2 images/overcloud-full_build.qcow2
##### Prep initial overcloud image with common deps #####
##########################################################
+# prep opnfv-puppet-tripleo for undercloud
+clone_fork opnfv-puppet-tripleo
+pushd opnfv-puppet-tripleo > /dev/null
+git archive --format=tar.gz --prefix=tripleo/ HEAD > ../opnfv-puppet-tripleo.tar.gz
+popd > /dev/null
+
pushd images > /dev/null
dpdk_pkg_str=''
@@ -29,10 +36,12 @@ for package in ${dpdk_rpms[@]}; do
dpdk_pkg_str+=" --upload $package:/root/dpdk_rpms"
done
-# remove openstack-neutron-openvswitch, ain't nobody need that in OPNFV
+# installing forked opnfv-puppet-tripleo
# enable connection tracking for protocal sctp
# upload dpdk rpms but do not install
LIBGUESTFS_BACKEND=direct virt-customize \
+ --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
+ --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
--run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
--run-command "mkdir /root/dpdk_rpms" \
$dpdk_pkg_str \
diff --git a/build/undercloud.sh b/build/undercloud.sh
index 551dbd88..c1d7c3ab 100755
--- a/build/undercloud.sh
+++ b/build/undercloud.sh
@@ -10,57 +10,26 @@
set -e
source ./cache.sh
source ./variables.sh
+source ./functions.sh
populate_cache "$rdo_images_uri/undercloud.qcow2"
if [ ! -d images ]; then mkdir images/; fi
cp -f cache/undercloud.qcow2 images/undercloud_build.qcow2
-#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
-
+# prep opnfv-tht for undercloud
+clone_fork 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_build.qcow2
-# install the packages above and enabling ceph to live on the controller
+pushd images > /dev/null
+# installing forked opnfv-tht
+# enabling ceph OSDs to live on the controller
# OpenWSMan package update supports the AMT Ironic driver for the TealBox
+# seeding configuration files specific to OPNFV
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" \
--run-command "sed -i '/ControllerEnableCephStorage/c\\ ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
--run-command "sed -i '/ComputeEnableCephStorage/c\\ ComputeEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
--run-command "curl http://download.opensuse.org/repositories/Openwsman/CentOS_CentOS-7/Openwsman.repo > /etc/yum.repos.d/wsman.repo" \