csantanapr closed pull request #3: stream install catalog with push package
URL: https://github.com/apache/incubator-openwhisk-package-deploy/pull/3
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/packages/installCatalog.sh b/packages/installCatalog.sh
index 6516869..ebf4eba 100755
--- a/packages/installCatalog.sh
+++ b/packages/installCatalog.sh
@@ -4,22 +4,28 @@
# automatically
#
# To run this command
-# ./installCatalog.sh <authkey> <edgehost> <apihost> <workers>
+# ./installCatalog.sh <AUTH> <EDGE_HOST> <WSK_CLI> <DOCKER>
+# AUTH and EDGE_HOST are found in $HOME/.wskprops
+# WSK_CLI="$OPENWHISK_HOME/bin/wsk"
set -e
set -x
-: ${OPENWHISK_HOME:?"OPENWHISK_HOME must be set and non-empty"}
-WSK_CLI="$OPENWHISK_HOME/bin/wsk"
-
if [ $# -eq 0 ]
then
-echo "Usage: ./installCatalog.sh <authkey> <edgehost> <apihost>"
+echo "Usage: ./installCatalog.sh <authkey> <edgehost> <pathtowskcli> <docker>"
fi
AUTH="$1"
-EDGEHOST="$2"
-APIHOST="$3"
+EDGE_HOST="$2"
+WSK_CLI="$3"
+DOCKER="$4"
+
+# If docker is not provided, set to default version.
+if [ -z "$4" ]
+ then
+ DOCKER="openwhisk/wskdeploy:0.8.10"
+fi
# If the auth key file exists, read the key in the file. Otherwise, take the
# first argument as the key itself.
@@ -27,26 +33,21 @@ if [ -f "$AUTH" ]; then
AUTH=`cat $AUTH`
fi
-# Make sure that the EDGEHOST is not empty.
-: ${EDGEHOST:?"EDGEHOST must be set and non-empty"}
-
-# Make sure that the APIHOST is not empty.
-: ${APIHOST:?"APIHOST must be set and non-empty"}
-
PACKAGE_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export WSK_CONFIG_FILE= # override local property file to avoid namespace
clashes
-echo Installing Deploy package.
+# wskdeploy actions
+
+echo Installing wskdeploy package.
-$WSK_CLI -i --apihost "$EDGEHOST" package update --auth "$AUTH" --shared yes
deploy \
- -a description 'Alarms and periodic utility' \
- -a parameters '[ {"message":"theMessage", "required":true} ]' \
- -p apihost "$APIHOST" \
- -p trigger_payload ''
+$WSK_CLI -i --apihost "$EDGE_HOST" package update --auth "$AUTH" --shared yes
"deploy" \
+-a description "This package offers a convenient way for you to describe and
deploy any part of the OpenWhisk programming model using a Manifest file
written in YAML." \
+-a prettyName "Whisk Deploy"
-$WSK_CLI -i --apihost "$EDGEHOST" action update --auth "$AUTH"
deploy/wskdeploy "$PACKAGE_HOME/actions/deploy.js" \
- -a description 'Creates an action that allows you to run wskdeploy from
OpenWhisk' \
- -a parameters '[ {"name":"gitUrl", "required":true, "bindTime":true,
"description": "The URL to the GitHub repository to deploy"},
{"name":"manifestPath", "required":false, "bindTime":true, "description": "The
relative path to the manifest file from the GitHub repo
root"},{"name":"wskApiHost", "required":false, "description": "The URL of the
OpenWhisk api host you want to use"}, {"name":"envData", "required":false,
"description": "Blueprint-specific environment data object"} ]' \
- -a sampleInput '{"gitUrl":"github.com/my_blueprint",
"manifestPath":"runtimes/swift",
"wskApiHost":"openwhisk.stage1.ng.bluemix.net", "envData":
"{\"KAFKA_ADMIN_URL\":\"https://my_kafka_service\",
\"MESSAGEHUB_USER\":\"MY_MESSAGEHUB_USERNAME\"}"}' \
- --docker "openwhisk/wskdeploy:0.8.9.2"
+$WSK_CLI -i --apihost "$EDGE_HOST" action update --auth "$AUTH"
"deploy/wskdeploy" "$PACKAGE_HOME/actions/deploy.js" \
+-a description 'Creates an action that allows you to run wskdeploy from
OpenWhisk' \
+-a parameters '[ {"name":"gitUrl", "required":true, "bindTime":true,
"description": "The URL to the GitHub repository to deploy"},
{"name":"manifestPath", "required":false, "bindTime":true, "description": "The
relative path to the manifest file from the GitHub repo root"},
{"name":"envData", "required":false, "description": "Blueprint-specific
environment data object"} ]' \
+-a sampleInput '{"gitUrl":"github.com/my_blueprint",
"manifestPath":"runtimes/swift", "envData": "{\"ENV_VARIABLE_1\":\"VALUE_1\",
\"ENV_VARIABLE_2\":\"VALUE_2\"}"}' \
+--docker "$DOCKER"
+
\ No newline at end of file
diff --git a/packages/uninstall.sh b/packages/uninstall.sh
index 6e9c7ef..3d9006b 100755
--- a/packages/uninstall.sh
+++ b/packages/uninstall.sh
@@ -7,14 +7,14 @@ WSK_CLI="$OPENWHISK_HOME/bin/wsk"
if [ $# -eq 0 ]
then
- echo "Usage: ./uninstall.sh $APIHOST $AUTH"
+ echo "Usage: ./uninstall.sh $EDGE_HOST $AUTH"
fi
-APIHOST="$1"
+EDGE_HOST="$1"
AUTH="$2"
echo Uninstalling Template Package \
-$WSK_CLI --apihost $APIHOST action delete -i --auth $AUTH deploy/wskdeploy
+$WSK_CLI --apihost $EDGE_HOST action delete -i --auth $AUTH deploy/wskdeploy
-$WSK_CLI --apihost $APIHOST package delete -i --auth $AUTH deploy
+$WSK_CLI --apihost $EDGE_HOST package delete -i --auth $AUTH deploy
diff --git a/tests/src/test/scala/packages/DeployTests.scala
b/tests/src/test/scala/packages/DeployTests.scala
index 6b4288e..e4da762 100644
--- a/tests/src/test/scala/packages/DeployTests.scala
+++ b/tests/src/test/scala/packages/DeployTests.scala
@@ -21,9 +21,9 @@ package packages
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
import org.scalatest.junit.JUnitRunner
-import common._
-import spray.json.DefaultJsonProtocol._
-import spray.json._
+import common.{TestHelpers, Wsk, WskProps, WskTestHelpers, _}
+import spray.json.DefaultJsonProtocol.StringJsonFormat
+import spray.json.pimpAny
@RunWith(classOf[JUnitRunner])
class DeployTests extends TestHelpers
@@ -47,8 +47,10 @@ class DeployTests extends TestHelpers
val helloWorldAction = "openwhisk-helloworld/helloworld"
val helloWorldActionPackage = "myPackage/helloworld"
+ behavior of "Deploy Package"
+
//test to create the hello world blueprint from github
- "Deploy Package" should "create the hello world action from github url" in
{
+ it should "create the hello world action from github url" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> deployTestRepo.toJson,
"manifestPath" -> helloWorldPath.toJson))
@@ -63,7 +65,7 @@ class DeployTests extends TestHelpers
}
//test to create the hello world blueprint from github with myPackage as
package name
- "Deploy Package" should s"create the $helloWorldActionPackage action from
github url" in {
+ it should s"create the $helloWorldActionPackage action from github url" in
{
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> deployTestRepo.toJson,
"manifestPath" -> helloWorldPackageParam.toJson,
@@ -79,7 +81,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with no github repo provided
- "Deploy Package" should "return error if there is no github repo provided"
in {
+ it should "return error if there is no github repo provided" in {
val run = wsk.action.invoke(deployAction, Map(
"manifestPath" -> helloWorldPath.toJson))
withActivation(wsk.activation, run) {
@@ -90,7 +92,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with a nonexistant github repo provided
- "Deploy Package" should "return error if there is an nonexistant repo
provided" in {
+ it should "return error if there is an nonexistant repo provided" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> incorrectGithubRepo.toJson,
"manifestPath" -> helloWorldPath.toJson))
@@ -102,7 +104,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with a malformed github repo
- "Deploy Package" should "return error if there is a malformed gitUrl
provided" in {
+ it should "return error if there is a malformed gitUrl provided" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> malformedRepoUrl.toJson,
"manifestPath" -> helloWorldPath.toJson))
@@ -114,7 +116,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with useless EnvData provided
- "Deploy Package" should "return succeed if useless envData is provided" in
{
+ it should "return succeed if useless envData is provided" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> deployTestRepo.toJson,
"manifestPath" -> helloWorldPath.toJson,
@@ -130,7 +132,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with an incorrect manifestPath provided
- "Deploy Package" should "return with failure if incorrect manifestPath is
provided" in {
+ it should "return with failure if incorrect manifestPath is provided" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> deployTestRepo.toJson,
"manifestPath" -> incorrectManifestPath.toJson))
@@ -142,7 +144,7 @@ class DeployTests extends TestHelpers
}
//test to create a blueprint with manifestPath provided, but no
manifestFile existing
- "Deploy Package" should "return with failure if no manifest exists at
manifestPath" in {
+ it should "return with failure if no manifest exists at manifestPath" in {
val run = wsk.action.invoke(deployAction, Map(
"gitUrl" -> deployTestRepo.toJson,
"manifestPath" -> helloWorldWithNoManifest.toJson))
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services