summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy.sh83
-rwxr-xr-xci/sdc_setup.sh27
-rwxr-xr-xci/upload.sh15
-rwxr-xr-xci/verify.sh12
4 files changed, 137 insertions, 0 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
new file mode 100755
index 0000000..4bdce89
--- /dev/null
+++ b/ci/deploy.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# Copyright (c) Authors of Clover
+#
+# 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
+#
+set -ex
+
+CLOVER_BASE_DIR=$(cd ${BASH_SOURCE[0]%/*}/..;pwd)
+CLOVER_WORK_DIR=$CLOVER_BASE_DIR/work
+MASTER_NODE_NAME="master"
+SSH_OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+K8S_ISTIO_DEPLOY_TIMEOUT=3600
+
+FUNCTEST_IMAGE="opnfv/functest-kubernetes-features:amd64-gambia"
+INSTALLER_TYPE="container4nfv"
+DEPLOY_SCENARIO="k8-istio-clover"
+
+mkdir -p $CLOVER_WORK_DIR
+cd $CLOVER_WORK_DIR
+
+# Fetch container4nfv source code
+if [ -d container4nfv ]; then
+ rm -rf container4nfv
+fi
+git clone https://git.opnfv.org/container4nfv/
+cd container4nfv
+
+# Create kubernetes + istio env
+timeout $K8S_ISTIO_DEPLOY_TIMEOUT ./src/vagrant/kubeadm_istio/deploy.sh
+
+# Fetch kube-master node info
+cd src/vagrant/kubeadm_istio
+MASTER_NODE_HOST=$(vagrant ssh-config $MASTER_NODE_NAME | awk '/HostName /{print $2}')
+MASTER_NODE_USER=$(vagrant ssh-config $MASTER_NODE_NAME | awk '/User /{print $2}')
+MASTER_NODE_KEY=$(vagrant ssh-config $MASTER_NODE_NAME | awk '/IdentityFile /{print $2}')
+
+# Push clover source code to kube-master node
+ssh $SSH_OPTIONS -i $MASTER_NODE_KEY ${MASTER_NODE_USER}@${MASTER_NODE_HOST} rm -rf clover
+scp $SSH_OPTIONS -i $MASTER_NODE_KEY -r $CLOVER_BASE_DIR ${MASTER_NODE_USER}@${MASTER_NODE_HOST}:clover
+
+# Deploy SDC sample for Functest test
+ssh $SSH_OPTIONS -i $MASTER_NODE_KEY ${MASTER_NODE_USER}@${MASTER_NODE_HOST} ./clover/ci/sdc_setup.sh
+
+echo "Clover deploy complete!"
+
+###############################################################################
+# Prepare and run functest.
+# TODO: Use jenkins to trigger functest job.
+
+# Setup configuration file for running functest
+mkdir -p $CLOVER_WORK_DIR/functest/results
+scp $SSH_OPTIONS -i $MASTER_NODE_KEY \
+ ${MASTER_NODE_USER}@${MASTER_NODE_HOST}:.kube/config \
+ $CLOVER_WORK_DIR/functest/kube-config
+RC_FILE=$CLOVER_WORK_DIR/functest/k8.creds
+echo "export KUBERNETES_PROVIDER=local" > $RC_FILE
+KUBE_MASTER_URL=$(cat $CLOVER_WORK_DIR/functest/kube-config | grep server | awk '{print $2}')
+echo "export KUBE_MASTER_URL=$KUBE_MASTER_URL" >> $RC_FILE
+KUBE_MASTER_IP=$(echo $KUBE_MASTER_URL | awk -F'https://|:[0-9]+' '$0=$2')
+echo "export KUBE_MASTER_IP=$KUBE_MASTER_IP" >> $RC_FILE
+
+# Restart docker service in case Container4NFV CI job delete docker0 bridge
+systemctl restart docker
+
+# Run functest
+sudo docker pull $FUNCTEST_IMAGE
+sudo docker run --rm \
+ -e INSTALLER_TYPE=$INSTALLER_TYPE \
+ -e NODE_NAME=$NODE_NAME \
+ -e DEPLOY_SCENARIO=$DEPLOY_SCENARIO \
+ -e BUILD_TAG=$BUILD_TAG \
+ -v $RC_FILE:/home/opnfv/functest/conf/env_file \
+ -v $CLOVER_WORK_DIR/functest/results:/home/opnfv/functest/results \
+ -v $CLOVER_WORK_DIR/functest/kube-config:/root/.kube/config \
+ $FUNCTEST_IMAGE \
+ /bin/bash -c 'run_tests -r -t all'
+
+echo "Clover run functest complete!"
+###############################################################################
diff --git a/ci/sdc_setup.sh b/ci/sdc_setup.sh
new file mode 100755
index 0000000..f4d82f5
--- /dev/null
+++ b/ci/sdc_setup.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Copyright (c) Authors of Clover
+#
+# 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
+#
+set -ex
+
+# Deploy Clover SDC sample
+kubectl apply -f <(istioctl kube-inject -f ~/clover/samples/scenarios/service_delivery_controller_opnfv.yaml)
+
+# Wait for SDC sample deployed
+kubectl get services
+kubectl get pods
+
+r="0"
+while [ $r -ne "10" ]
+do
+ sleep 30
+ kubectl get pods
+ r=$(kubectl get pods | grep Running | wc -l)
+done
+
+echo "Set up Clover SDC sample complete!"
diff --git a/ci/upload.sh b/ci/upload.sh
new file mode 100755
index 0000000..05ab08c
--- /dev/null
+++ b/ci/upload.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+# Copyright (c) Authors of Clover
+#
+# 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
+#
+set -ex
+
+echo dummy > dummy
+gsutil cp dummy gs://$GS_URL/dummy
+
+echo "Clover upload complete!"
diff --git a/ci/verify.sh b/ci/verify.sh
new file mode 100755
index 0000000..c1d65a4
--- /dev/null
+++ b/ci/verify.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+#
+# Copyright (c) Authors of Clover
+#
+# 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
+#
+set -ex
+
+echo "Clover verify complete!"