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

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


The following commit(s) were added to refs/heads/master by this push:
     new 701f707  Fix API gw installation issue and use local .wskprops files 
(#200)
701f707 is described below

commit 701f7074a5dfc75c0c5ef1db46ba4c58f7395d20
Author: rodric rabbah <[email protected]>
AuthorDate: Mon Feb 18 08:24:34 2019 -0500

    Fix API gw installation issue and use local .wskprops files (#200)
    
    * Improvements to make quick-start.
    
    * Use local wskproperties file instead of overwriting the users file if it 
exists.
---
 .gitignore              |  1 +
 docker-compose/Makefile | 54 ++++++++++++++++++++++++++-----------------------
 2 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3cdf0a8..3d8fc6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 openwhisk-src
+.wskprops
 
 *.iml
 .idea
diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 15dd0b1..7d60234 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -19,9 +19,10 @@ DOCKER_HOST_IP ?= $(shell echo ${DOCKER_HOST} | grep -o 
"[0-9]\{1,3\}\.[0-9]\{1,
 DOCKER_REGISTRY ?= ""
 DOCKER_IMAGE_PREFIX ?= openwhisk
 OPENWHISK_VERSION ?= master
-OPENWHISK_PROJECT_HOME ?= ./openwhisk-src
-OPENWHISK_CATALOG_HOME ?= ./openwhisk-catalog
+OPENWHISK_PROJECT_HOME ?= $(CURDIR)/openwhisk-src
+OPENWHISK_CATALOG_HOME ?= $(CURDIR)/openwhisk-catalog
 WSK_CLI ?= $(OPENWHISK_PROJECT_HOME)/bin/wsk
+WSK_CONFIG_FILE=$(CURDIR)/.wskprops
 OPEN_WHISK_DB_PREFIX ?= local_
 
 DOCKER_KERNEL ?= $(shell docker version --format "{{.Server.KernelVersion}}")
@@ -46,10 +47,10 @@ add-catalog: download-catalog init-catalog
 
 .PHONY: download-src
 download-src:
-       if [ ! $(OPENWHISK_PROJECT_HOME) = "./openwhisk-src" ]; then \
+       if [ ! $(OPENWHISK_PROJECT_HOME) = "$(CURDIR)/openwhisk-src" ]; then \
                echo "Skipping downloading the code as OPENWHISK_PROJECT_HOME 
is set to " $(OPENWHISK_PROJECT_HOME); \
        else \
-               rm -rf ./openwhisk-src; \
+               rm -rf $(CURDIR)/openwhisk-src; \
                curl -o ./openwhisk-src.tar.gz -L 
https://github.com/apache/incubator-openwhisk/archive/$(OPENWHISK_VERSION).tar.gz;
 \
                echo "Unpacking tarball."; \
            mkdir -p $(OPENWHISK_PROJECT_HOME); \
@@ -59,8 +60,8 @@ download-src:
 
 .PHONY: download-catalog
 download-catalog:
-       if [ "$(OPENWHISK_CATALOG_HOME)" = "./openwhisk-catalog" ]; then \
-           rm -rf ./openwhisk-catalog*; \
+       if [ "$(OPENWHISK_CATALOG_HOME)" = "$(CURDIR)/openwhisk-catalog" ]; 
then \
+           rm -rf $(CURDIR)/openwhisk-catalog*; \
            curl -O ./openwhisk-catalog.tar.gz -L 
https://api.github.com/repos/apache/incubator-openwhisk-catalog/tarball/master 
> ./openwhisk-catalog.tar.gz; \
            mkdir openwhisk-catalog; \
            tar -xf ./openwhisk-catalog.tar.gz --strip 1 -C openwhisk-catalog; \
@@ -77,9 +78,10 @@ quick-start-pause:
 
 .PHONY: quick-start-info
 quick-start-info:
-       echo "$$(tput setaf 2)To invoke the function again use: $$(tput setaf 
4)make hello-world$$(tput sgr0)"
-       echo "$$(tput setaf 2)To stop OpenWhisk use: $$(tput setaf 4)make 
destroy$$(tput sgr0)"
-
+       echo "$$(tput setaf 2)To invoke the function again use: $$(tput setaf 
6)make hello-world$$(tput sgr0)"
+       echo "$$(tput setaf 2)To stop OpenWhisk use: $$(tput setaf 6)make 
destroy$$(tput sgr0)"
+       echo "$$(tput setaf 2)To use the wsk CLI: $$(tput setaf 6)export 
WSK_CONFIG_FILE=$(WSK_CONFIG_FILE)$$(tput sgr0)"
+       echo "                    $$(tput setaf 6)or copy the file to 
$(HOME)/.wskprops$$(tput sgr0)"
 # deprecated commands
 .PHONY: docker_build
 docker_build:
@@ -292,15 +294,17 @@ init-couchdb:
 init-whisk-cli:
        echo "waiting for the Whisk controller to come up ... "
        until $$(curl --output /dev/null --silent --head --fail 
http://$(DOCKER_HOST_IP):8888/ping); do printf '.'; sleep 5; done
-       echo "initializing CLI ... "
-       $(WSK_CLI) -v property set --namespace guest --auth `cat 
$(OPENWHISK_PROJECT_HOME)/ansible/files/auth.guest` --apihost 
https://$(DOCKER_HOST_IP) -i
+       echo "initializing CLI properties into $(WSK_CONFIG_FILE)"
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) property set --namespace 
guest --auth `cat $(OPENWHISK_PROJECT_HOME)/ansible/files/auth.guest` --apihost 
https://$(DOCKER_HOST_IP) -i
 
 .PHONY: init-api-management
 init-api-management:
-       $(WSK_CLI) -v property set --namespace whisk.system --auth `cat 
$(OPENWHISK_PROJECT_HOME)/ansible/files/auth.whisk.system` --apihost 
$(DOCKER_HOST_IP) -i
-       GW_USER="" GW_PWD="" GW_HOST_V2="http://$(DOCKER_HOST_IP):9000/v2" 
OPENWHISK_HOME=$(OPENWHISK_PROJECT_HOME) \
-               
$(OPENWHISK_PROJECT_HOME)/ansible/roles/routemgmt/files/installRouteMgmt.sh 
$(shell cat $(OPENWHISK_PROJECT_HOME)/ansible/files/auth.whisk.system) 
$(DOCKER_HOST_IP) /whisk.system $(WSK_CLI)
-       $(WSK_CLI) -v property set --namespace guest --auth `cat 
$(OPENWHISK_PROJECT_HOME)/ansible/files/auth.guest` --apihost $(DOCKER_HOST_IP) 
-i
+       touch $(OPENWHISK_PROJECT_HOME)/whisk.properties
+       GW_USER="" \
+       GW_PWD="" \
+       GW_HOST_V2="http://$(DOCKER_HOST_IP):9000/v2" \
+       OPENWHISK_HOME=$(OPENWHISK_PROJECT_HOME) \
+       
$(OPENWHISK_PROJECT_HOME)/ansible/roles/routemgmt/files/installRouteMgmt.sh 
$(shell cat $(OPENWHISK_PROJECT_HOME)/ansible/files/auth.whisk.system) 
$(DOCKER_HOST_IP) /whisk.system $(WSK_CLI)
 
 .PHONY: init-catalog
 init-catalog:
@@ -331,25 +335,25 @@ hello-world: create-hello-world-function
        echo "invoking the hello-world function ... "
 
        echo "$$(tput setaf 4)adding the function to whisk ...$$(tput sgr0)"
-       $(WSK_CLI) -i action create hello hello.js
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action create hello 
hello.js
 
        echo "$$(tput setaf 4)invoking the function ...$$(tput sgr0)"
-       res=`$(WSK_CLI) -i action invoke hello --blocking --result` \
+       res=`WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action invoke 
hello --blocking --result` \
            && echo "invocation result:" $$res \
-           && (echo $$res | grep "Hello, World") || ($(WSK_CLI) -i action 
delete hello && tail -n 200 ~/tmp/openwhisk/invoker/logs/invoker-local_logs.log 
~/tmp/openwhisk/controller/logs/controller-local_logs.log && exit 1)
+           && (echo $$res | grep "Hello, World") || 
(WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action delete hello && tail 
-n 200 ~/tmp/openwhisk/invoker/logs/invoker-local_logs.log 
~/tmp/openwhisk/controller/logs/controller-local_logs.log && exit 1)
 
        echo "$$(tput setaf 4)creating an API from the hello function 
...$$(tput sgr0)"
-       $(WSK_CLI) -i action update "/guest/hello" --web true
-       web_action=`$(WSK_CLI) -i api create /hello /world get hello 
--response-type json | tail -n 1` \
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action update 
"/guest/hello" --web true
+       web_action=`WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i api create 
/hello /world get hello --response-type json | tail -n 1` \
            && echo "invoking: " $$web_action \
            && (echo $$web_action | xargs curl -sS | grep "Hello, World") || 
(echo "Error invoking the web action" && tail -n 200 
~/tmp/openwhisk/invoker/logs/invoker-local_logs.log 
~/tmp/openwhisk/controller/logs/controller-local_logs.log && exit 1)
-       $(WSK_CLI) -i api list /hello
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i api list /hello
 
        echo "$$(tput setaf 1)deleting the API ...$$(tput sgr0)"
-       $(WSK_CLI) -i api delete /hello
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i api delete /hello
 
        echo "$$(tput setaf 1)deleting the function ...$$(tput sgr0)"
-       $(WSK_CLI) -i action delete hello
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action delete hello
        rm hello.js
 
 .PHONY: create-hello-world-function
@@ -360,7 +364,7 @@ create-hello-world-function:
 # Using the hello-world function this task executes a performance test using 
Apache Benchmark
 .PHONY: hello-world-perf-test
 hello-world-perf-test: create-hello-world-function
-       $(WSK_CLI) -i action create hello-perf hello.js
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action create 
hello-perf hello.js
 
        docker run --rm \
            --net openwhisk_default \
@@ -369,7 +373,7 @@ hello-world-perf-test: create-hello-world-function
                    -H "Content-Type:application/json" \
                    
http://controller:8888/api/v1/namespaces/guest/actions/hello-perf?blocking=true
 
-       $(WSK_CLI) -i action delete hello-perf
+       WSK_CONFIG_FILE=$(WSK_CONFIG_FILE) $(WSK_CLI) -i action delete 
hello-perf
        rm hello.js
 
 .PHONY: pull

Reply via email to