aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelen Chen <helen.chen@huawei.com>2018-05-24 15:17:06 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-24 15:17:06 +0000
commit8c3f3665ff959cd932d893d0f0eb6f89194735b0 (patch)
treea4417ab99d91b7a751a3967ba93713a83eaf7d37
parentcdb14b501affca5a430b598a43f34d04c4e909c2 (diff)
parentd257997583713a65c404ed8a48b21a414d1f2804 (diff)
Merge "Enhance OOM deploy script"
-rwxr-xr-xdeployment/heat/onap-oom/scripts/deploy.sh38
1 files changed, 32 insertions, 6 deletions
diff --git a/deployment/heat/onap-oom/scripts/deploy.sh b/deployment/heat/onap-oom/scripts/deploy.sh
index 656b410a9..134ba6bdc 100755
--- a/deployment/heat/onap-oom/scripts/deploy.sh
+++ b/deployment/heat/onap-oom/scripts/deploy.sh
@@ -20,11 +20,25 @@ for n in $(seq 1 5); do
cd $WORKSPACE/deployment/heat/onap-oom
envsubst < $ENV_FILE > $ENV_FILE~
- openstack stack create -t ./onap-oom.yaml -e $ENV_FILE~ onap-oom
+
+ if ! openstack stack create -t ./onap-oom.yaml -e $ENV_FILE~ onap-oom; then
+ break
+ fi
+
+ while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value onap-oom)" ]; do
+ sleep 20
+ done
+
+ STATUS=$(openstack stack show -c stack_status -f value onap-oom)
+ echo $STATUS
+ if [ "CREATE_COMPLETE" != "$STATUS" ]; then
+ break
+ fi
for i in $(seq 1 30); do
sleep 30
RANCHER_IP=$(openstack stack output show onap-oom rancher_vm_ip -c output_value -f value)
+ K8S_IP=$(openstack stack output show onap-oom k8s_1_vm_ip -c output_value -f value)
timeout 1 ping -c 1 "$RANCHER_IP" && break
done
@@ -38,18 +52,30 @@ if ! timeout 1 ping -c 1 "$RANCHER_IP"; then
exit 2
fi
+ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP "sed -u '/Cloud-init.*finished/q' <(tail -n+0 -f /var/log/cloud-init-output.log)"
+
ssh-keygen -R $RANCHER_IP
for n in $(seq 1 6); do
- timeout 15m ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"'
+ timeout 15m ssh -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"'
RESULT=$?
if [ $RESULT -eq 0 ]; then
break
fi
sleep 15m
done
-ROBOT_POD=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//')
-LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP "sudo su -c \"kubectl exec $ROBOT_POD --namespace onap -- ls -1t /share/logs | head -1\"")
+ROBOT_POD=$(ssh -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//')
+if [ "$ROBOT_POD" == "" ]; then
+ exit 1
+fi
+
+LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep {robot-tag} | head -1" | ssh -i $SSH_KEY ubuntu@$RANCHER_IP sudo su)
+if [ "$LOG_DIR" == "" ]; then
+ exit 1
+fi
+
+echo "kubectl cp -n onap $ROBOT_POD:share/logs/$LOG_DIR /tmp/robot/logs/$LOG_DIR" | ssh -i $SSH_KEY ubuntu@$RANCHER_IP sudo su
+rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$RANCHER_IP:/tmp/robot/logs/$LOG_DIR/ $WORKSPACE/archives/
+
+echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
-K8S_IP=$(openstack stack output show onap-oom k8s_1_vm_ip -c output_value -f value)
-wget --user=robot --password=robot -r -np -nH --cut-dirs=2 -R "index.html*" -P $WORKSPACE/archives/ http://$K8S_IP:30209/logs/$LOG_DIR/
exit 0