Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##############################################################################
# Copyright 2017 IBM Corporation
#
# Licensed 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.
##############################################################################
language: bash
sudo: true

script:
- ./travis-test.sh
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/IBM/openwhisk-data-processing-message-hub.svg?branch=master)](https://travis-ci.org/IBM/openwhisk-data-processing-message-hub)

# Getting Started with OpenWhisk and Message Hub
This project provides sample code for creating your Message Hub (Kafka) data processing app with Apache OpenWhisk on IBM Bluemix. It should take no more than 10 minutes to get up and running.

Expand Down
7 changes: 2 additions & 5 deletions actions/mhpost/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"name": "mypost",
"version": "0.1",
"version": "0.1.0",
"description": "Action posting messages to a Message Hub topic",
"author": "IBM",
"license": "Apache-2.0",
"dependencies": {
"message-hub-rest": "file:./node_modules/message-hub-rest"
},
"engines": {
"node": "6.9"
"message-hub-rest": "1.2.0"
},
"main": "index.js"
}
4 changes: 4 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# Load configuration variables
source local.env

function usage() {
echo -e "Usage: $0 [--install,--uninstall,--env]"
}

function install() {
echo -e "Installing OpenWhisk actions, triggers, and rules for openwhisk-data-processing-message-hub..."

Expand Down
2 changes: 1 addition & 1 deletion kafka_consume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ decode_response() {
local ARG=$1
local ENCODED=${1##*,\"value\":\"}
local ENCODED=${ENCODED%%\",\"partition\":*}
DECODED=`echo $ENCODED | base64 -D`
DECODED=`echo $ENCODED | base64 --decode`
fi
}

Expand Down
64 changes: 64 additions & 0 deletions travis-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

##############################################################################
# Copyright 2017 IBM Corporation
#
# Licensed 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.
##############################################################################
set -e

OPEN_WHISK_BIN=/home/ubuntu/bin
LINK=https://openwhisk.ng.bluemix.net/cli/go/download/linux/amd64/wsk

echo "Downloading OpenWhisk CLI from '$LINK'...\n"
curl -O $LINK
chmod u+x wsk
export PATH=$PATH:`pwd`

echo "Configuring CLI from apihost and API key\n"
wsk property set --apihost openwhisk.ng.bluemix.net --auth $OPEN_WHISK_KEY #OPEN_WHISK_KEY defined in travis-ci console

echo "Configure local.env"
touch local.env #Configurations defined in travis-ci console

echo "installing jq for bash json parsing"
sudo apt-get install jq

echo "Deploying wsk actions, etc."
./deploy.sh --install

echo "Waiting for triggers/actions to finish installing (sleep 5)"
sleep 5

echo "Publishing a kafka message"
./kafka_publish.sh

echo "Waiting for triggers/actions to finish executing(sleep 5)"
sleep 5

echo "Consuming kafka out-topic queue"
KAFKA_MESSAGE=`./kafka_consume.sh | tail -3 | head -1`
echo "consumed message: $KAFKA_MESSAGE"

MSG_AGENT=`echo $KAFKA_MESSAGE | jq -r '.agent'`
if [[ $MSG_AGENT == "OpenWhisk action" ]]
then
echo "Found the message we were expecting"
else
echo "Something went wrong"
echo "Uninstalling wsk actions, etc."
./deploy.sh --uninstall
exit -1
fi

echo "Uninstalling wsk actions, etc."
./deploy.sh --uninstall