You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ho...@apache.org on 2017/08/17 15:41:45 UTC

[incubator-openwhisk-deploy-kube] branch master updated (bf0f1c0 -> facb52b)

This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git.


    from bf0f1c0   Deploy CouchDB manually (#46)
     new 74ca0e8  run travis files from propert directory;add scancode again.
     new facb52b  run travis files from propert directory;add scancode again.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .travis.yml                        |  2 ++
 {.travis => tools/travis}/build.sh |  0
 tools/travis/scancode.sh           | 11 +++++++++++
 {.travis => tools/travis}/setup.sh |  0
 tools/travis/setupscan.sh          |  8 ++++++++
 5 files changed, 21 insertions(+)
 copy {.travis => tools/travis}/build.sh (100%)
 create mode 100755 tools/travis/scancode.sh
 copy {.travis => tools/travis}/setup.sh (100%)
 create mode 100755 tools/travis/setupscan.sh

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].

[incubator-openwhisk-deploy-kube] 01/02: run travis files from propert directory; add scancode again.

Posted by ho...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git

commit 74ca0e8480d92e1947ce8c227b7722e91a746bae
Author: Matt Rutkowski <mr...@us.ibm.com>
AuthorDate: Thu Aug 17 09:31:52 2017 -0500

    run travis files from propert directory;add scancode again.
---
 .travis.yml                        |  6 ++++--
 {.travis => tools/travis}/build.sh |  0
 tools/travis/scancode.sh           | 11 +++++++++++
 {.travis => tools/travis}/setup.sh |  0
 tools/travis/setupscan.sh          |  8 ++++++++
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b9d1ccb..654780c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,9 @@ services:
   - docker
 
 before_install:
-  - .travis/setup.sh
+  - ./tools/travis/setupscan.sh
+  - ./tools/travis/setup.sh
 
 script:
-  - .travis/build.sh
+  - ./tools/travis/scancode.sh
+  - ./tools/travis/build.sh
diff --git a/.travis/build.sh b/tools/travis/build.sh
similarity index 100%
rename from .travis/build.sh
rename to tools/travis/build.sh
diff --git a/tools/travis/scancode.sh b/tools/travis/scancode.sh
new file mode 100755
index 0000000..2202c45
--- /dev/null
+++ b/tools/travis/scancode.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+# Build script for Travis-CI.
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+UTIL_DIR="$ROOTDIR/../incubator-openwhisk-utilities"
+
+# run scancode
+cd $UTIL_DIR
+scancode/scanCode.py $ROOTDIR
\ No newline at end of file
diff --git a/.travis/setup.sh b/tools/travis/setup.sh
similarity index 100%
rename from .travis/setup.sh
rename to tools/travis/setup.sh
diff --git a/tools/travis/setupscan.sh b/tools/travis/setupscan.sh
new file mode 100755
index 0000000..35f070f
--- /dev/null
+++ b/tools/travis/setupscan.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+HOMEDIR="$SCRIPTDIR/../../../"
+
+# clone OpenWhisk utilities repo. in order to run scanCode.py
+cd $HOMEDIR
+git clone https://github.com/apache/incubator-openwhisk-utilities.git

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-deploy-kube] 02/02: run travis files from propert directory; add scancode again.

Posted by ho...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git

commit facb52b0675f3d6fbabfccb287ff25ac815b2a87
Author: Matt Rutkowski <mr...@us.ibm.com>
AuthorDate: Thu Aug 17 10:12:05 2017 -0500

    run travis files from propert directory;add scancode again.
---
 .travis.yml              |   4 +-
 .travis/build.sh         | 200 +++++++++++++++++++++++++++++++++++++++++++++++
 .travis/setup.sh         |  66 ++++++++++++++++
 tools/travis/scancode.sh |   2 +-
 4 files changed, 269 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 654780c..e794123 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,8 +14,8 @@ services:
 
 before_install:
   - ./tools/travis/setupscan.sh
-  - ./tools/travis/setup.sh
+  - .travis/setup.sh
 
 script:
   - ./tools/travis/scancode.sh
-  - ./tools/travis/build.sh
+  - .travis/build.sh
diff --git a/.travis/build.sh b/.travis/build.sh
new file mode 100755
index 0000000..6eca786
--- /dev/null
+++ b/.travis/build.sh
@@ -0,0 +1,200 @@
+#!/bin/bash
+
+set -x
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../"
+
+cd $ROOTDIR
+
+kubectl apply -f configure/openwhisk_kube_namespace.yml
+
+couchdbHealthCheck () {
+  # wait for the pod to be created before getting the job name
+  sleep 5
+  POD_NAME=$(kubectl -n openwhisk get pods -o wide --show-all | grep "couchdb" | awk '{print $1}')
+
+  PASSED=false
+  TIMEOUT=0
+  until [ $TIMEOUT -eq 25 ]; do
+    if [ -n "$(kubectl -n openwhisk logs $POD_NAME | grep "Apache CouchDB has started on http://0.0.0.0:5984")" ]; then
+      break
+    fi
+
+    let TIMEOUT=TIMEOUT+1
+    sleep 30
+  done
+
+  if [ $TIMEOUT -eq 25 ]; then
+    echo "Failed to finish deploying CouchDB"
+
+    kubectl -n openwhisk logs $POD_NAME
+    exit 1
+  fi
+
+  echo "CouchDB is up and running"
+}
+
+deploymentHealthCheck () {
+  if [ -z "$1" ]; then
+    echo "Error, component health check called without a component parameter"
+    exit 1
+  fi
+
+  PASSED=false
+  TIMEOUT=0
+  until $PASSED || [ $TIMEOUT -eq 25 ]; do
+    KUBE_DEPLOY_STATUS=$(kubectl -n openwhisk get pods -o wide | grep "$1" | awk '{print $3}')
+    if [ "$KUBE_DEPLOY_STATUS" == "Running" ]; then
+      PASSED=true
+      break
+    fi
+
+    kubectl get pods --all-namespaces -o wide --show-all
+
+    let TIMEOUT=TIMEOUT+1
+    sleep 30
+  done
+
+  if [ "$PASSED" = false ]; then
+    echo "Failed to finish deploying $1"
+
+    kubectl -n openwhisk logs $(kubectl -n openwhisk get pods -o wide | grep "$1" | awk '{print $1}')
+    exit 1
+  fi
+
+  echo "$1 is up and running"
+}
+
+statefulsetHealthCheck () {
+  if [ -z "$1" ]; then
+    echo "Error, StatefulSet health check called without a parameter"
+    exit 1
+  fi
+
+  PASSED=false
+  TIMEOUT=0
+  until $PASSED || [ $TIMEOUT -eq 25 ]; do
+    KUBE_DEPLOY_STATUS=$(kubectl -n openwhisk get pods -o wide | grep "$1"-0 | awk '{print $3}')
+    if [ "$KUBE_DEPLOY_STATUS" == "Running" ]; then
+      PASSED=true
+      break
+    fi
+
+    kubectl get pods --all-namespaces -o wide --show-all
+
+    let TIMEOUT=TIMEOUT+1
+    sleep 30
+  done
+
+  if [ "$PASSED" = false ]; then
+    echo "Failed to finish deploying $1"
+
+    kubectl -n openwhisk logs $(kubectl -n openwhisk get pods -o wide | grep "$1"-0 | awk '{print $1}')
+    exit 1
+  fi
+
+  echo "$1-0 is up and running"
+
+}
+
+# setup couchdb
+pushd kubernetes/couchdb
+  kubectl apply -f couchdb.yml
+
+  couchdbHealthCheck
+popd
+
+# setup zookeeper
+pushd kubernetes/zookeeper
+  kubectl apply -f zookeeper.yml
+
+  deploymentHealthCheck "zookeeper"
+popd
+
+# setup kafka
+pushd kubernetes/kafka
+  kubectl apply -f kafka.yml
+
+  deploymentHealthCheck "kafka"
+popd
+
+# setup the controller
+pushd kubernetes/controller
+  kubectl apply -f controller.yml
+
+  statefulsetHealthCheck "controller"
+popd
+
+# setup the invoker
+pushd kubernetes/invoker
+  kubectl apply -f invoker.yml
+
+  # wait until the invoker is ready
+  statefulsetHealthCheck "invoker"
+popd
+
+# setup nginx
+pushd kubernetes/nginx
+  ./certs.sh localhost
+  kubectl -n openwhisk create configmap nginx --from-file=nginx.conf
+  kubectl -n openwhisk create secret tls nginx --cert=certs/cert.pem --key=certs/key.pem
+  kubectl apply -f nginx.yml
+
+  # wait until nginx is ready
+  deploymentHealthCheck "nginx"
+popd
+
+AUTH_WSK_SECRET=789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
+AUTH_GUEST=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
+WSK_PORT=$(kubectl -n openwhisk describe service nginx | grep https-api | grep NodePort| awk '{print $3}' | cut -d'/' -f1)
+
+# download and setup the wsk cli from nginx
+wget --no-check-certificate https://localhost:$WSK_PORT/cli/go/download/linux/amd64/wsk
+chmod +x wsk
+sudo cp wsk /usr/local/bin/wsk
+
+./wsk property set --auth $AUTH_GUEST --apihost https://localhost:$WSK_PORT
+
+
+# setup the catalog
+pushd /tmp
+  git clone https://github.com/apache/incubator-openwhisk
+  export OPENWHISK_HOME=$PWD/incubator-openwhisk
+
+  git clone https://github.com/apache/incubator-openwhisk-catalog
+
+  pushd incubator-openwhisk-catalog/packages
+    export WHISK_CLI_PATH=/usr/local/bin/wsk
+
+    # This script currently has an issue where the cli path is the 4th argument
+    ./installCatalog.sh $AUTH_WSK_SECRET https://localhost:$WSK_PORT $WHISK_CLI_PATH
+  popd
+popd
+
+# create wsk action
+cat > hello.js << EOL
+function main() {
+  return {payload: 'Hello world'};
+}
+EOL
+
+./wsk -i action create hello hello.js
+
+sleep 5
+
+# run the new hello world action
+RESULT=$(./wsk -i action invoke --blocking hello | grep "\"status\": \"success\"")
+
+if [ -z "$RESULT" ]; then
+  echo "FAILED! Could not invoked custom action"
+
+  echo " ----------------------------- controller logs ---------------------------"
+  kubectl -n openwhisk logs controller-0
+
+  echo " ----------------------------- invoker logs ---------------------------"
+  kubectl -n openwhisk logs invoker-0
+  exit 1
+fi
+
+echo "PASSED! Deployed openwhisk and invoked custom action"
diff --git a/.travis/setup.sh b/.travis/setup.sh
new file mode 100755
index 0000000..6fdbc42
--- /dev/null
+++ b/.travis/setup.sh
@@ -0,0 +1,66 @@
+# This script assumes Docker is already installed
+#!/bin/bash
+
+set -x
+
+# set docker0 to promiscuous mode
+sudo ip link set docker0 promisc on
+
+# install etcd
+wget https://github.com/coreos/etcd/releases/download/$TRAVIS_ETCD_VERSION/etcd-$TRAVIS_ETCD_VERSION-linux-amd64.tar.gz
+tar xzf etcd-$TRAVIS_ETCD_VERSION-linux-amd64.tar.gz
+sudo mv etcd-$TRAVIS_ETCD_VERSION-linux-amd64/etcd /usr/local/bin/etcd
+rm etcd-$TRAVIS_ETCD_VERSION-linux-amd64.tar.gz
+rm -rf etcd-$TRAVIS_ETCD_VERSION-linux-amd64
+
+# download kubectl
+wget https://storage.googleapis.com/kubernetes-release/release/$TRAVIS_KUBE_VERSION/bin/linux/amd64/kubectl
+chmod +x kubectl
+sudo mv kubectl /usr/local/bin/kubectl
+
+# download kubernetes
+git clone https://github.com/kubernetes/kubernetes $HOME/kubernetes
+
+# install cfssl
+go get -u github.com/cloudflare/cfssl/cmd/...
+
+pushd $HOME/kubernetes
+  git checkout $TRAVIS_KUBE_VERSION
+  kubectl config set-credentials myself --username=admin --password=admin
+  kubectl config set-context local --cluster=local --user=myself
+  kubectl config set-cluster local --server=http://localhost:8080
+  kubectl config use-context local
+
+  # start kubernetes in the background
+  sudo PATH=$PATH:/home/travis/.gimme/versions/go1.7.linux.amd64/bin/go \
+       KUBE_ENABLE_CLUSTER_DNS=true \
+       hack/local-up-cluster.sh &
+popd
+
+# Wait until kube is up and running
+TIMEOUT=0
+TIMEOUT_COUNT=40
+until $( curl --output /dev/null --silent http://localhost:8080 ) || [ $TIMEOUT -eq $TIMEOUT_COUNT ]; do
+  echo "Kube is not up yet"
+  let TIMEOUT=TIMEOUT+1
+  sleep 20
+done
+
+if [ $TIMEOUT -eq $TIMEOUT_COUNT ]; then
+  echo "Kubernetes is not up and running"
+  exit 1
+fi
+
+echo "Kubernetes is deployed and reachable"
+
+# Try and sleep before issuing chown. Currently, Kubernetes is started by
+# a command that is run in the background. Technically Kubernetes could be
+# up and running, but those files might not exist yet as the previous command
+# could create them after Kube starts successfully.
+sleep 5
+
+sudo chown -R $USER:$USER $HOME/.kube
+
+# Have seen issues where chown does not instantly change file permissions.
+# When this happens the build.sh cript can have failures.
+sleep 30
diff --git a/tools/travis/scancode.sh b/tools/travis/scancode.sh
index 2202c45..ebfa361 100755
--- a/tools/travis/scancode.sh
+++ b/tools/travis/scancode.sh
@@ -8,4 +8,4 @@ UTIL_DIR="$ROOTDIR/../incubator-openwhisk-utilities"
 
 # run scancode
 cd $UTIL_DIR
-scancode/scanCode.py $ROOTDIR
\ No newline at end of file
+scancode/scanCode.py $ROOTDIR

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.