openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk-deploy-kube] branch master updated: upload logs to box at end of build (#111)
Date Fri, 08 Dec 2017 12:03:31 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 12103a9  upload logs to box at end of build (#111)
12103a9 is described below

commit 12103a9f1f194f70ddf8d99acd3e95e8e3f2a749
Author: David Grove <dgrove-oss@users.noreply.github.com>
AuthorDate: Fri Dec 8 07:03:29 2017 -0500

    upload logs to box at end of build (#111)
---
 .travis.yml                  | 17 ++++++++----
 tools/travis/box-upload.py   | 63 ++++++++++++++++++++++++++++++++++++++++++++
 tools/travis/collect-logs.sh | 25 ++++++++++++++++++
 3 files changed, 100 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d120ba6..c8587e5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,18 +1,25 @@
 sudo: required
+
 env:
   global:
   - TRAVIS_KUBE_VERSION=v1.7.4
   - TRAVIS_MINIKUBE_VERSION=v0.23.0
   - secure: d7CuMXbhT83W2x78qiLwgogX1+3aPicd1PlTwwNNDN6QSkImbxareyKThnsqlHIiNj3o5l5DBuiYjy7wrF/xD1g8BQMmTwm99DRx5q3CI3Im3VCi/ZK8SaNjuOy24d7cf5k2tB/87Gk7zmKsMDYm+fpCl+GpgUmIEeIwthiAxuXSDWZ8eQPIptmxj56DeFRNouvXG+dEUtBfWiwN27UPxNKExCixFnegmdtffLbz6hhst7BHr5Ry9acbycre98PCwWZcu9lxFs+SJ1kvnzX2iue4otmDkF1WkJjxaOFPJVs/D3YItg+neLCSxjwBskPed+Fct8bOjcM/uVROJPNIq5icBmaPX2isH0lvtxOeVw/dmioWYXYPN9ygBOe4eO/vtPllN0bcAUo5xl9jXev8ciAozYrYpHVh9Fplfd81rcYTeYzALmRJBdoiWoc3KQGzwGc9sB1ffmy+KWgG9T0zbnS4fALSR4PS
[...]
   - secure: CJtnU94HTDqd4A6uvhFl8IpnmU+wTdlzb8bPBFUl/lI/VKXiRrYpgJdKUro5xEoxFKuqMprLhbyf66niyWLTIeogjUAEu/h/o2dBVeGgSGKoqC0hQgqvnxKFeGlzFJ0XuEs3vbStJGRnQszGsfnnDrscJtR0x9X+1w4aBKI7iPyyuFtVkDD1UsmBbSi+M8FTeq7G7A0reMDaey7uog3CFCpIMl4geshcohQEcKEGbnXQZoLPFpb7cBOE83VXBJ7Y7Dgf/U4keiLovvnuJThGKZm/SVV2KlELmBmtmbx3rMT6Vb5k9ChSdRWapromNnnzmJBIQ5Scc2mwV3A93/SMha1F3IlYpDKs5djfTw8jZfVnuiou7HhTaRjHkmmcwP12/k30gLe2kw0Vezg1TCY4zgtOpcmCxc8RHEy0ceA74rKvRi8LbexTCwX+iAMQFn/pSrh/OqAq/50JbLyczcoO1zXWS38txUQN
[...]
+
 services:
-- docker
+  - docker
+
 before_install:
-- "./tools/travis/setupscan.sh"
-- "./tools/travis/setup.sh"
+  - ./tools/travis/setupscan.sh
+  - ./tools/travis/setup.sh
+
 script:
-- "./tools/travis/scancode.sh"
-- "./tools/travis/build.sh"
+  - ./tools/travis/scancode.sh
+  - ./tools/travis/build.sh
+  - ./tools/travis/collect-logs.sh
+  - ./tools/travis/box-upload.py "$TRAVIS_BUILD_DIR/logs" "deploy-kube-$TRAVIS_BUILD_ID-$TRAVIS_BRANCH.tar.gz"
+
 deploy:
 - provider: script
   script: "./tools/travis/publish.sh openwhisk kube-couchdb latest"
diff --git a/tools/travis/box-upload.py b/tools/travis/box-upload.py
new file mode 100755
index 0000000..e240449
--- /dev/null
+++ b/tools/travis/box-upload.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+"""Executable Python script for compressing folders to Box.
+
+Compresses the contents of a folder and upload the result to Box.
+
+  Run this script as:
+  $ upload-logs.py LOG_DIR DEST_NAME
+
+  e.g.: $ upload-logs.py /tmp/wsklogs logs-5512.tar.gz
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+"""
+
+import os
+import subprocess
+import sys
+import tempfile
+import urllib
+
+
+def upload_file(local_file, remote_file):
+    """Upload file."""
+    if remote_file[0] == '/':
+        remote_file = remote_file[1:]
+
+    subprocess.call(["curl", "-X", "POST", "--data-binary", "@%s" % local_file,
+                     "http://wsklogfwd.mybluemix.net/upload?%s" %
+                     urllib.urlencode({"name": remote_file})])
+
+
+def tar_gz_dir(dir_path):
+    """Create TAR (ZIP) of path and its contents."""
+    _, dst = tempfile.mkstemp(suffix=".tar.gz")
+    subprocess.call(["tar", "-cvzf", dst, dir_path])
+    return dst
+
+if __name__ == "__main__":
+    dir_path = sys.argv[1]
+    dst_path = sys.argv[2]
+
+    if not os.path.isdir(dir_path):
+        print("Directory doesn't exist: %s." % dir_path)
+        sys.exit(0)
+
+    print("Compressing logs dir...")
+    tar = tar_gz_dir(dir_path)
+    print("Uploading to Box...")
+    upload_file(tar, dst_path)
diff --git a/tools/travis/collect-logs.sh b/tools/travis/collect-logs.sh
new file mode 100755
index 0000000..0670bde
--- /dev/null
+++ b/tools/travis/collect-logs.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -x
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../../"
+
+cd $ROOTDIR
+
+echo "Gathering logs to upload to https://app.box.com/v/openwhisk-travis-logs"
+
+mkdir logs
+
+# Logs from all the pods
+kubectl -n openwhisk logs -lname=couchdb >& logs/couchdb.log
+kubectl -n openwhisk logs -lname=zookeeper >& logs/zookeeper.log
+kubectl -n openwhisk logs -lname=kafka >& logs/kafka.log
+kubectl -n openwhisk logs controller-0 >& logs/controller-0.log
+kubectl -n openwhisk logs controller-1 >& logs/controller-1.log
+kubectl -n openwhisk logs -lname=invoker >& logs/invoker.log
+kubectl -n openwhisk logs -lname=nginx >& logs/nginx.log
+kubectl get pods --all-namespaces -o wide --show-all >& logs/all-pods.txt
+
+# System level logs from minikube
+minikube logs >& logs/minikube.log

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

Mime
View raw message