Add honeycomb to build process
[apex.git] / build / undercloud.sh
index f2e9879..10c46e7 100755 (executable)
 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/
-
-#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
+cp -f cache/undercloud.qcow2 images/undercloud_build.qcow2
 
+# 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.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
+# add congress client and apply: https://review.openstack.org/#/c/297515/
+# add congress password to python-triploclient
+# add tacker password to python-tripleoclient
+# upload tacker repo and install the client package
 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" \
@@ -68,7 +41,24 @@ LIBGUESTFS_BACKEND=direct virt-customize \
     --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \
     --upload ../opnfv-environment.yaml:/home/stack/ \
     --upload ../virtual-environment.yaml:/home/stack/ \
-    -a undercloud.qcow2
+    --install "python2-congressclient" \
+    --upload ../python-congressclient.diff:/tmp \
+    --run-command "cd /usr/lib/python2.7/site-packages && patch -p1 < /tmp/python-congressclient.diff" \
+    --run-command "sed -i '/SERVICE_LIST/a\\    \x27congress\x27: {\x27password_field\x27: \x27OVERCLOUD_CONGRESS_PASSWORD\x27},' /usr/lib/python2.7/site-packages/tripleoclient/constants.py" \
+    --run-command "sed -i '/PASSWORD_NAMES =/a\\    \"OVERCLOUD_CONGRESS_PASSWORD\",' /usr/lib/python2.7/site-packages/tripleoclient/utils.py" \
+    --run-command "sed -i '/AodhPassword/a\\        parameters\[\x27CongressPassword\x27\] = passwords\[\x27OVERCLOUD_CONGRESS_PASSWORD\x27\]' /usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_deploy.py" \
+    --run-command "sed -i '/^SERVICES/a\    \x27congress\x27: {\x27description\x27: \x27Congress Service\x27, \x27type\x27: \x27policy\x27, \x27path\x27: \x27/\x27, \x27port\x27: 1789 },' /usr/lib/python2.7/site-packages/os_cloud_config/keystone.py" \
+    --run-command "sed -i '/SERVICE_LIST/a\\    \x27tacker\x27: {\x27password_field\x27: \x27OVERCLOUD_TACKER_PASSWORD\x27},' /usr/lib/python2.7/site-packages/tripleoclient/constants.py" \
+    --run-command "sed -i '/PASSWORD_NAMES =/a\\    \"OVERCLOUD_TACKER_PASSWORD\",' /usr/lib/python2.7/site-packages/tripleoclient/utils.py" \
+    --run-command "sed -i '/AodhPassword/a\\        parameters\[\x27TackerPassword\x27\] = passwords\[\x27OVERCLOUD_TACKER_PASSWORD\x27\]' /usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_deploy.py" \
+    --run-command "sed -i '/^SERVICES/a\    \x27tacker\x27: {\x27description\x27: \x27Tacker Service\x27, \x27type\x27: \x27servicevm\x27, \x27path\x27: \x27/\x27, \x27port\x27: 1789 },' /usr/lib/python2.7/site-packages/os_cloud_config/keystone.py" \
+    --upload ../noarch/python-tackerclient-2015.2-1.trozet.noarch.rpm:/root/ \
+    --install /root/python-tackerclient-2015.2-1.trozet.noarch.rpm \
+    --install "python2-aodhclient" \
+    --install "openstack-heat-engine" \
+    --install "openstack-heat-api-cfn" \
+    --install "openstack-heat-api" \
+    -a undercloud_build.qcow2
 
 # Add custom IPA to allow kernel params
 wget https://raw.githubusercontent.com/trozet/ironic-python-agent/opnfv_kernel/ironic_python_agent/extensions/image.py
@@ -79,6 +69,7 @@ LIBGUESTFS_BACKEND=direct virt-customize --upload ../build_perf_image.sh:/home/s
                                          --upload ../set_perf_images.sh:/home/stack \
                                          --upload image.py:/root \
                                          --upload image.pyc:/root \
-                                         -a undercloud.qcow2
+                                         -a undercloud_build.qcow2
 
+mv -f undercloud_build.qcow2 undercloud.qcow2
 popd > /dev/null