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

msciabarra 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 a27454c  Actionloop sdk (#225)
a27454c is described below

commit a27454cd845ef1b7b2ceda72d3c73723a74084dd
Author: Michele Sciabarra <[email protected]>
AuthorDate: Wed Mar 27 12:42:33 2019 +0100

    Actionloop sdk (#225)
    
    * example with tests
    
    * fixed scan errors
---
 actionloop-starter-kit/.gitattributes              |  31 ++++
 actionloop-starter-kit/.gitignore                  |  36 +++++
 actionloop-starter-kit/.scalafmt.conf              |   9 ++
 actionloop-starter-kit/.travis.yml                 |  47 ++++++
 actionloop-starter-kit/README.md                   |  22 +++
 actionloop-starter-kit/build.gradle                |  31 ++++
 actionloop-starter-kit/example/Makefile            |  26 ++++
 actionloop-starter-kit/example/__main__.py         |  20 +++
 actionloop-starter-kit/example/hello.py            |  20 +++
 actionloop-starter-kit/gradle/README.md            |  64 ++++++++
 actionloop-starter-kit/gradle/docker.gradle        | 116 ++++++++++++++
 .../gradle/wrapper/gradle-wrapper.jar              | Bin 0 -> 54708 bytes
 .../gradle/wrapper/gradle-wrapper.properties       |   8 +
 actionloop-starter-kit/gradlew                     | 172 +++++++++++++++++++++
 actionloop-starter-kit/gradlew.bat                 |  84 ++++++++++
 actionloop-starter-kit/python3.7/Dockerfile        |  25 +++
 actionloop-starter-kit/python3.7/Makefile          |  40 +++++
 actionloop-starter-kit/python3.7/bin/compile       |  79 ++++++++++
 actionloop-starter-kit/python3.7/build.gradle      |  19 +++
 actionloop-starter-kit/python3.7/lib/launcher.py   |  49 ++++++
 actionloop-starter-kit/settings.gradle             |  36 +++++
 actionloop-starter-kit/tests/build.gradle          |  44 ++++++
 .../ActionLoopPythonBasicTests.scala               |  94 +++++++++++
 actionloop-starter-kit/tools/invoke.py             | 135 ++++++++++++++++
 actionloop-starter-kit/tools/travis/build.sh       |  43 ++++++
 actionloop-starter-kit/tools/travis/publish.sh     |  64 ++++++++
 actionloop-starter-kit/tools/travis/setup.sh       |  34 ++++
 actionloop-starter-kit/tools/travis/test.sh        |  30 ++++
 28 files changed, 1378 insertions(+)

diff --git a/actionloop-starter-kit/.gitattributes 
b/actionloop-starter-kit/.gitattributes
new file mode 100644
index 0000000..b19d1c0
--- /dev/null
+++ b/actionloop-starter-kit/.gitattributes
@@ -0,0 +1,31 @@
+# Auto detect text files and perform LF normalization.
+# Resources:
+#       - https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
+#       - 
http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
+#       - https://help.github.com/articles/dealing-with-line-endings/
+* text=auto
+
+*.go            text eol=lf
+*.java          text
+*.js            text
+*.md            text
+*.py            text eol=lf
+*.scala         text
+*.sh            text eol=lf
+*.gradle        text
+*.xml           text
+*.bat           text eol=crlf
+
+*.jar           binary
+*.png           binary
+
+# python files not having the .py extension
+tools/cli/wsk      text eol=lf
+tools/cli/wskadmin text eol=lf
+
+# bash files not having the .sh extension
+tools/vagrant/simple/wsk        text eol=lf
+gradlew                         text eol=lf
+core/javaAction/proxy/gradlew   text eol=lf
+tools/vagrant/hello             text eol=lf
+sdk/docker/client/action        text eol=lf
diff --git a/actionloop-starter-kit/.gitignore 
b/actionloop-starter-kit/.gitignore
new file mode 100644
index 0000000..514b1e1
--- /dev/null
+++ b/actionloop-starter-kit/.gitignore
@@ -0,0 +1,36 @@
+action/
+results/
+logs/
+out/
+build/
+*.retry
+
+# Linux
+*~
+
+# Mac
+.DS_Store
+
+# Gradle
+.gradle
+build/
+!/tools/build/
+
+# Python
+.ipynb_checkpoints/
+*.pyc
+
+# NodeJS
+node_modules
+
+# Vagrant
+.vagrant*
+
+# IntelliJ
+.idea
+*.class
+*.iml
+out/
+
+# .zip files must be explicited whitelisted
+*.zip
diff --git a/actionloop-starter-kit/.scalafmt.conf 
b/actionloop-starter-kit/.scalafmt.conf
new file mode 100644
index 0000000..7084efe
--- /dev/null
+++ b/actionloop-starter-kit/.scalafmt.conf
@@ -0,0 +1,9 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+style = intellij
+danglingParentheses = false
+maxColumn = 120
+docstrings = JavaDoc
+rewrite.rules = [SortImports]
+project.git = true
diff --git a/actionloop-starter-kit/.travis.yml 
b/actionloop-starter-kit/.travis.yml
new file mode 100644
index 0000000..79b2212
--- /dev/null
+++ b/actionloop-starter-kit/.travis.yml
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+sudo: required
+group: deprecated-2017Q3
+language: scala
+scala:
+- 2.12.7
+services:
+  - docker
+# required to support multi-stage build
+addons:
+   apt:
+     packages:
+       - docker-ce
+before_install:
+  - "./tools/travis/setup.sh"
+install: true
+script:
+  - "./tools/travis/build.sh && ./tools/travis/test.sh"
+deploy:
+  - provider: script
+    script: "./tools/travis/publish.sh openwhisk ${TRAVIS_TAG%@*} 
${TRAVIS_TAG##*@}"
+    on:
+      tags: true
+      all_branches: true
+      repo: apache/incubator-openwhisk-runtime-python
+  - provider: script
+    script: "./tools/travis/publish.sh openwhisk 3 latest && 
./tools/travis/publish.sh openwhisk 3-ai latest && ./tools/travis/publish.sh 
openwhisk 3-loop latest"
+    on:
+      branch: master
+      repo: apache/incubator-openwhisk-runtime-python
+env:
+  global:
+  - secure: 
Ac7MlWUpsLwmbcjCigDf+vftiXAEJbf78FVm2QCd4IeFqlRiNbQm3bWRXOOW3Zqh4R4o/wSFpFq0qKPrI9WJjOcxD0GxFboq2iGWTegddfDbENV/IBmjurl6NzYY6dUB7GUSmHYy6tdKnxMhjHzZCn2m4OVWltcMtnOV0G+uYvbnre7vXfb67duzJF+mYpJJ7rC0wGh+N50bYvm0BTtPcQMYJibq6sDTY8Lr1b74QGdM/sODre69CbuiwAA7Ed0hajEcMkv8YnwY0De/PL7hthUyCWSD+i1AhtD+3odA64yX/pAbBzfCcqPoI0Nt5ZmAAUKLJ9pAHCc74dlmYzj9wj1z5TS0nLOE2l++vNvgsA3/c+lqrBv6hc9FmSKx4yfNdFCakVLEfdRJw/45ibIRN5dCW5tDdIx8aciBV8c0CyYgSLRvtVuvw5IX7fbwhHOZ8ftTRzCHS0Nd9zs4x3za+1aucWFQEyrk
 [...]
+  - secure: 
fte97QoQReAM0obk/tjxYvF/zhRbcyIFxa1jnFuv1m1YKA/pEWue5uMIDZZa1pynN9rFFgOvR2W34Gm2aHl0wJs18Oqi2Es1cSfDDmuYguEIYZmlfbrjXY2gvitH5+6JA6fc4aMmrgOav+WVbzdzBqy511CWEDsejWflAnFpKJqTnYdLqe8L8FAJfteY/cj5Bvz7G5o8WbH+ag2CopjkEKkx4KXsJ7DadKI+BbI9hkMUvPVnTULaf7Q5z3oG92g1XwjKrfN6Z2y8tQukWg+n5pfVY0yLpWvd/Q/9HyilB0s06EzORzE00DTLnvYNGaVsx99m6H11e0Tn5Sx5S6rJOmJa5T2vTPGmsojpgHm1Lz12AYVxRmWvFbTLg8KDNN9H6uTc8DKPGb/mLkkD5ruWXJWjvpd+m+eRcpJOZ9cvPXWFYvCF0VAPCbK0DakInnmCvZyQ6ZLFgGrtkNt51kkTZGR68d0UW9rw
 [...]
+notifications:
+  slack:
+    secure: 
ipYx0BX7TwWmG+qeyAllxBxrPn21dJubfEbALn8yTOZfykTWpVtohWrqieAnc6kFQRqz1TAs1wzyjvTcutaIMi9C7FcJrYRIMUMpyID3ca5FeZopr/LBW53XHj/SgZWwFRAnWsjYnSydfZJnUBInI6por8jdVqVgsCMTDsvcXFEoHdVj9M93aB7y8pgqZhfYkQOPojktDu7nMxjsjKJN7dT+g/1kVWtS8DQQCXHTPP44YquxOCgAFn+CZjes9Jm+vz5lk5Azksi48yiHwFiLYZo5gcnwr2n2IspjBs6db10rkCe693vIpoW4T3KujMIKwVXrgUl4pDME1nN/loEBHm0DjKoeOD13DHqITMTPX4sR94TCGf0lMyaag/JOETdDgC9hAbh4aSx1cj4hGXiuGrNMbYblMBsjvujqFp2nraw/DE93pHGRY9lbBZIjEVhj/jBmOv1I3yRdXHj4VybZc4JGnfQVGz/R
 [...]
+    on_pull_requests: false
+    on_success: change
+    on_failure: always
+  webhooks:
+    urls:
+      # travis2slack webhook to enable DMs on openwhisk-team.slack.com to PR 
authors with TravisCI results
+      secure: 
"jhiMGpQ6kJFWjjsO68RmgD2Lga7jgNE+EKwND0dMOvzf5llMLFDKcY5J3tgtrqYaslQdXeuYeru/9qJrTTjFEu+vz3iCwoJ/eme+D0TtTIFGlPr7oa9tZlWrkPM/0zFLq7KjJauIIX2+6qrGVrNJJ6ENfr4U8Ir8q51oLIk44bsCeB8EmkahPOlNG6kcNqgpxHWKYUdUIg3B0GxqCKida/76dXDTRHCV2dZuT2bXz2oSJYog/lybomsjQIUZj0+HqxecgWTzag3Y6rTpK+m+vywazHP91hE+oU4e7YrxCH6v9+ukoWaljFqO5ZEKXcpx6tzx8Q0FvoTP8vGOO9b/t1loVcA8OxSJDrtOAztfoz/u0HJN6vnVt+maqnrYAD1F4pxA63JA6/+a7firmtADP7A/WQMZg6RgEkGUr+amFn303dTvgjDDkZ4oH8MAr0EPsneGUA2MZgB3i1MEcnCrYzT7KpYmD
 [...]
+
diff --git a/actionloop-starter-kit/README.md b/actionloop-starter-kit/README.md
new file mode 100644
index 0000000..5503242
--- /dev/null
+++ b/actionloop-starter-kit/README.md
@@ -0,0 +1,22 @@
+<!--
+#
+# 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.
+#
+-->
+# ActionLoop Started Kit
+
+Use the content of this folder to build your own ActionLoop based runtime.
+
diff --git a/actionloop-starter-kit/build.gradle 
b/actionloop-starter-kit/build.gradle
new file mode 100644
index 0000000..26f542d
--- /dev/null
+++ b/actionloop-starter-kit/build.gradle
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+buildscript {
+    repositories {
+        jcenter()
+    }
+    dependencies {
+        classpath "cz.alenkacz:gradle-scalafmt:${gradle.scalafmt.version}"
+    }
+}
+
+subprojects {
+    apply plugin: 'scalafmt'
+    scalafmt.configFilePath = gradle.scalafmt.config
+}
+
diff --git a/actionloop-starter-kit/example/Makefile 
b/actionloop-starter-kit/example/Makefile
new file mode 100644
index 0000000..67d9468
--- /dev/null
+++ b/actionloop-starter-kit/example/Makefile
@@ -0,0 +1,26 @@
+IMG=actionloop/actionloop-demo-python-v3.7:latest
+ACT=hello-demo-python
+
+src.zip:
+       zip src.zip __main__.py hello.py
+
+bin.zip: src.zip
+       docker run -i $(IMG) -compile main <src.zip >bin.zip
+
+single:
+       wsk action update $(ACT) hello.py --docker $(IMG) --main hello
+
+src-zip: src.zip
+       wsk action update $(ACT) $< --docker $(IMG)
+
+bin-zip: bin.zip
+       wsk action update $(ACT) $< --docker $(IMG)
+
+test:
+       wsk action invoke $(ACT) -r
+       wsk action invoke $(ACT) -p name Mike -r
+
+.PHONE: single src-zip bin-zip
+
+
+
diff --git a/actionloop-starter-kit/example/__main__.py 
b/actionloop-starter-kit/example/__main__.py
new file mode 100644
index 0000000..c2c04cc
--- /dev/null
+++ b/actionloop-starter-kit/example/__main__.py
@@ -0,0 +1,20 @@
+#
+# 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 hello
+
+def main(args):
+    return hello.hello(args)
diff --git a/actionloop-starter-kit/example/hello.py 
b/actionloop-starter-kit/example/hello.py
new file mode 100644
index 0000000..9f41943
--- /dev/null
+++ b/actionloop-starter-kit/example/hello.py
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+def hello(args):
+    name = args["name"] if "name" in args else "world"
+    print("name=%s" % name)
+    return {"greeting": "Hello, %s" % name }
diff --git a/actionloop-starter-kit/gradle/README.md 
b/actionloop-starter-kit/gradle/README.md
new file mode 100644
index 0000000..14842f1
--- /dev/null
+++ b/actionloop-starter-kit/gradle/README.md
@@ -0,0 +1,64 @@
+<!--
+#
+# 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.
+#
+-->
+
+# Gradle
+
+Gradle is used to build OpenWhisk. It does not need to be pre-installed as it 
installs itself using the [Gradle 
Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html). To use 
it without installing, simply invoke the `gradlew` command at the root of the 
repository. You can also install `gradle` via 
[`apt`](http://linuxg.net/how-to-install-gradle-2-1-on-ubuntu-14-10-ubuntu-14-04-ubuntu-12-04-and-derivatives/)
 on Ubuntu or [`brew`](http://www.brewformulas.org/Gradle) on Mac [...]
+
+## Usage
+
+In general, project level properties are set via 
`-P{propertyName}={propertyValue}`. A task is called via `gradle {taskName}` 
and a subproject task is called via `gradle :path:to:subproject:{taskName}`. To 
run tasks in parallel, use the `--parallel` flag (**Note:** It's an incubating 
feature and might break stuff).
+
+### Build
+
+To build all Docker images use `gradle distDocker` at the top level project, 
to build a specific component use `gradle :core:controller:distDocker`.
+
+Project level options that can be used on `distDocker`:
+
+- `dockerImageName` (*required*): The name of the image to build (e.g. 
whisk/controller)
+- `dockerHost` (*optional*): The docker host to run commands on, default 
behaviour is docker's own `DOCKER_HOST` environment variable
+- `dockerRegistry` (*optional*): The registry to push to
+- `dockerImageTag` (*optional*, default 'latest'): The tag for the image
+- `dockerTimeout` (*optional*, default 240): Timeout for docker operations in 
seconds
+- `dockerRetries` (*optional*, default 3): How many times to retry docker 
operations
+- `dockerBinary` (*optional*, default `docker`): The binary to execute docker 
commands
+
+### Test
+
+To run tests one uses the `test` task. OpenWhisk consolidates tests into a 
single `tests` project. Hence the command to run all tests is `gradle 
:tests:test`.
+
+It is possible to run specific tests using [Gradle 
testfilters](https://docs.gradle.org/current/userguide/java_plugin.html#test_filtering).
 For example `gradle :tests:test --tests 
"your.package.name.TestClass.evenMethodName"`. Wildcard `*` may be used 
anywhere.
+
+## Build your own `build.gradle`
+In Gradle, most of the tasks we use are default tasks provided by plugins in 
Gradle. The [`scala` 
Plugin](https://docs.gradle.org/current/userguide/scala_plugin.html) for 
example includes tasks, that are needed to build Scala projects. Moreover, 
Gradle is aware of *Applications*. The [`application` 
Plugin](https://docs.gradle.org/current/userguide/application_plugin.html) 
provides tasks that are required to distribute a self-contained application. 
When `application` and `scala` are used  [...]
+
+In OpenWhisk, we want to distribute our application via Docker images. Hence 
we wrote a "plugin" that creates the task `distDocker`. That task will build an 
image from the `Dockerfile` that is located next to the `build.gradle` it is 
called from, for example Controller's `Dockerfile` and `build.gradle` are both 
located at `core/controller`.
+
+If you want to create a new `build.gradle` for your component, simply put the 
`Dockerfile` right next to it and include `docker.gradle` by using
+
+```
+ext.dockerImageName = 'openwwhisk/{IMAGENAME}'
+apply from: 'path/to/docker.gradle'
+```
+
+If your component needs to be build before you can build the image, make 
`distDocker` depend on any task needed to run before it, for example:
+
+```
+distDocker.dependsOn ':common:scala:distDocker', 'distTar'
+```
diff --git a/actionloop-starter-kit/gradle/docker.gradle 
b/actionloop-starter-kit/gradle/docker.gradle
new file mode 100644
index 0000000..6ad6850
--- /dev/null
+++ b/actionloop-starter-kit/gradle/docker.gradle
@@ -0,0 +1,116 @@
+/*
+ * 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 groovy.time.*
+
+/**
+ * Utility to build docker images based in gradle projects
+ *
+ * This extends gradle's 'application' plugin logic with a 'distDocker' task 
which builds
+ * a docker image from the Dockerfile of the project that applies this file. 
The image
+ * is automatically tagged and pushed if a tag and/or a registry is given.
+ *
+ * Parameters that can be set on project level:
+ * - dockerImageName (required): The name of the image to build (e.g. 
controller)
+ * - dockerRegistry (optional): The registry to push to
+ * - dockerImageTag (optional, default 'latest'): The tag for the image
+ * - dockerImagePrefix (optional, default 'whisk'): The prefix for the image,
+ *       'controller' becomes 'whisk/controller' per default
+ * - dockerTimeout (optional, default 840): Timeout for docker operations in 
seconds
+ * - dockerRetries (optional, default 3): How many times to retry docker 
operations
+ * - dockerBinary (optional, default 'docker'): The binary to execute docker 
commands
+ * - dockerBuildArgs (options, default ''): Project specific custom docker 
build arguments
+ * - dockerHost (optional): The docker host to run commands on, default 
behaviour is
+ *       docker's own DOCKER_HOST environment variable
+ */
+
+ext {
+    dockerRegistry = project.hasProperty('dockerRegistry') ? dockerRegistry + 
'/' : ''
+    dockerImageTag = project.hasProperty('dockerImageTag') ? dockerImageTag : 
'latest'
+    dockerImagePrefix = project.hasProperty('dockerImagePrefix') ? 
dockerImagePrefix : 'whisk'
+    dockerTimeout = project.hasProperty('dockerTimeout') ? 
dockerTimeout.toInteger() : 840
+    dockerRetries = project.hasProperty('dockerRetries') ? 
dockerRetries.toInteger() : 3
+    dockerBinary = project.hasProperty('dockerBinary') ? [dockerBinary] : 
['docker']
+    dockerBuildArg = ['build']
+}
+ext.dockerTaggedImageName = dockerRegistry + dockerImagePrefix + '/' + 
dockerImageName + ':' + dockerImageTag
+
+if(project.hasProperty('dockerHost')) {
+    dockerBinary += ['--host', project.dockerHost]
+}
+
+if(project.hasProperty('dockerBuildArgs')) {
+    dockerBuildArgs.each { arg  ->
+        dockerBuildArg += ['--build-arg', arg]
+    }
+}
+
+task distDocker {
+    doLast {
+        def start = new Date()
+        def cmd = dockerBinary + dockerBuildArg + ['-t', dockerImageName, 
project.buildscript.sourceFile.getParentFile().getAbsolutePath()]
+        retry(cmd, dockerRetries, dockerTimeout)
+        println("Building '${dockerImageName}' took ${TimeCategory.minus(new 
Date(), start)}")
+    }
+}
+task tagImage {
+    doLast {
+        def versionString = (dockerBinary + ['-v']).execute().text
+        def matched = (versionString =~ /(\d+)\.(\d+)\.(\d+)/)
+
+        def major = matched[0][1] as int
+        def minor = matched[0][2] as int
+
+        def dockerCmd = ['tag']
+        if(major == 1 && minor < 12) {
+            dockerCmd += ['-f']
+        }
+        retry(dockerBinary + dockerCmd + [dockerImageName, 
dockerTaggedImageName], dockerRetries, dockerTimeout)
+    }
+}
+
+task pushImage {
+    doLast {
+        def cmd = dockerBinary + ['push', dockerTaggedImageName]
+        retry(cmd, dockerRetries, dockerTimeout)
+    }
+}
+pushImage.dependsOn tagImage
+pushImage.onlyIf { dockerRegistry != '' }
+distDocker.finalizedBy pushImage
+
+def retry(cmd, retries, timeout) {
+    println("${new Date()}: Executing '${cmd.join(" ")}'")
+    def proc = cmd.execute()
+    proc.consumeProcessOutput(System.out, System.err)
+    proc.waitForOrKill(timeout * 1000)
+    if(proc.exitValue() != 0) {
+        def message = "${new Date()}: Command '${cmd.join(" ")}' failed with 
exitCode ${proc.exitValue()}"
+        if(proc.exitValue() == 143) { // 143 means the process was killed 
(SIGTERM signal)
+            message = "${new Date()}: Command '${cmd.join(" ")}' was killed 
after ${timeout} seconds"
+        }
+
+        if(retries > 1) {
+            println("${message}, ${retries-1} retries left, retrying...")
+            retry(cmd, retries-1, timeout)
+        }
+        else {
+            println("${message}, no more retries left, aborting...")
+            throw new GradleException(message)
+        }
+    }
+}
diff --git a/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.jar 
b/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7a3265e
Binary files /dev/null and 
b/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.properties 
b/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..d7cc33f
--- /dev/null
+++ b/actionloop-starter-kit/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,8 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
diff --git a/actionloop-starter-kit/gradlew b/actionloop-starter-kit/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/actionloop-starter-kit/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to 
pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 
'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; 
then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" 
\"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### 
Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### 
Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" 
"$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" 
"$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" 
"$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; 
done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and 
substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 
"\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" 
org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder 
on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/actionloop-starter-kit/gradlew.bat 
b/actionloop-starter-kit/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/actionloop-starter-kit/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS 
to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your 
PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% 
"-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" 
org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code 
instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/actionloop-starter-kit/python3.7/Dockerfile 
b/actionloop-starter-kit/python3.7/Dockerfile
new file mode 100644
index 0000000..5b10fc8
--- /dev/null
+++ b/actionloop-starter-kit/python3.7/Dockerfile
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+FROM actionloop/actionloop-v2:latest as builder
+FROM python:3.7-alpine
+RUN mkdir -p /proxy/bin /proxy/lib /proxy/action
+WORKDIR /proxy
+COPY --from=builder bin/proxy /bin/proxy
+ADD lib/launcher.py /proxy/lib/launcher.py
+ADD bin/compile /proxy/bin/compile
+ENV OW_COMPILER=/proxy/bin/compile
+ENTRYPOINT ["/bin/proxy"]
\ No newline at end of file
diff --git a/actionloop-starter-kit/python3.7/Makefile 
b/actionloop-starter-kit/python3.7/Makefile
new file mode 100644
index 0000000..fe9ee2c
--- /dev/null
+++ b/actionloop-starter-kit/python3.7/Makefile
@@ -0,0 +1,40 @@
+IMG=actionloop-demo-python-v3.7:latest
+INVOKE=python ../tools/invoke.py
+PREFIX=docker.io/actionloop
+
+build:
+       docker build -t $(IMG) .
+
+push: build
+       docker login
+       docker tag $(IMG) $(PREFIX)/$(IMG) 
+       docker push $(PREFIX)/$(IMG)
+
+clean:
+       docker rmi -f $(IMG)
+
+start: build
+       docker run -p 8080:8080 -ti -v $(PWD):/proxy $(IMG) 
+
+debug: build
+       docker run -p 8080:8080 -ti --entrypoint=/bin/sh -v $(PWD):/proxy 
$(IMG) 
+
+.PHONY: build push clean start debug
+
+## You need to execute make start in another terminal 
+test-single:
+       $(INVOKE) init hello ../example/hello.py
+       $(INVOKE) run '{}'
+       $(INVOKE) run '{"name":"Mike"}'
+
+test-src-zip:
+       $(MAKE) -C ../example src.zip
+       $(INVOKE) init ../example/src.zip
+       $(INVOKE) run '{}'
+       $(INVOKE) run '{"name":"Mike"}'
+
+test-bin-dir:
+       $(MAKE) -C ../example bin.zip
+       $(INVOKE) init ../example/bin.zip
+       $(INVOKE) run '{}'
+       $(INVOKE) run '{"name":"Mike"}'
diff --git a/actionloop-starter-kit/python3.7/bin/compile 
b/actionloop-starter-kit/python3.7/bin/compile
new file mode 100755
index 0000000..9fea0ab
--- /dev/null
+++ b/actionloop-starter-kit/python3.7/bin/compile
@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+"""Python Action Builder
+#
+# 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.
+#
+"""
+
+from __future__ import print_function
+import os, sys, codecs, shutil
+from os.path import abspath, exists, dirname
+
+# write a file creating intermediate directories
+def write_file(file, body, executable=False):
+    os.makedirs(dirname(file), mode=0o755, exist_ok=True)
+    with open(file, mode="w", encoding="utf-8") as f:
+        f.write(body)
+    if executable:
+        os.chmod(file, 0o755)
+
+# copy a file eventually replacing a substring
+def copy_replace(src, dst, match=None, replacement=""):
+    with codecs.open(src, 'r', 'utf-8') as s:
+        body = s.read()
+        if match:
+            body = body.replace(match, replacement)
+        write_file(dst, body)
+
+# assemble sources
+def sources(launcher, main, src_dir):  
+    # move exec in the right place if exists
+    src_file = "%s/exec" % src_dir
+    if exists(src_file):
+        copy_replace(src_file, "%s/main__.py" % src_dir)
+
+    # move __main__ in the right place if it exists
+    src_file = "%s/__main__.py" % src_dir
+    if exists(src_file):
+        copy_replace(src_file, "%s/main__.py" % src_dir)
+
+    # write the boilerplate in a temp dir
+    copy_replace(launcher, "%s/exec__.py" % src_dir,
+          "from main__ import main as main",
+          "from main__ import %s as main" % main )
+
+# compile sources
+def build(src_dir, tgt_dir):
+    # in general, compile your program into an executable format
+    # for scripting languages, move sources and create a launcher
+    # move away the action dir and replace with the new
+    shutil.rmtree(tgt_dir)
+    shutil.move(src_dir, tgt_dir)
+    write_file("%s/exec" % tgt_dir, """#!/bin/sh
+cd "$(dirname $0)"
+exec /usr/local/bin/python exec__.py
+""")
+
+if __name__ == '__main__':
+    if len(sys.argv) < 4:
+        sys.stdout.write("usage: <main-function> <source-dir> <target-dir>\n")
+        sys.stdout.flush()
+        sys.exit(1)
+    launcher = "%s/lib/launcher.py" % dirname(dirname(sys.argv[0]))
+    sources(launcher, sys.argv[1], abspath(sys.argv[2]))
+    build(abspath(sys.argv[2]), abspath(sys.argv[3]))
+    sys.stdout.flush()
+    sys.stderr.flush()
diff --git a/actionloop-starter-kit/python3.7/build.gradle 
b/actionloop-starter-kit/python3.7/build.gradle
new file mode 100644
index 0000000..30ebf1e
--- /dev/null
+++ b/actionloop-starter-kit/python3.7/build.gradle
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+ext.dockerImageName = 'actionloop-demo-python-v3.7'
+apply from: '../gradle/docker.gradle'
diff --git a/actionloop-starter-kit/python3.7/lib/launcher.py 
b/actionloop-starter-kit/python3.7/lib/launcher.py
new file mode 100644
index 0000000..7d277b5
--- /dev/null
+++ b/actionloop-starter-kit/python3.7/lib/launcher.py
@@ -0,0 +1,49 @@
+#
+# 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.
+#
+from __future__ import print_function
+from sys import stdin
+from sys import stdout
+from sys import stderr
+from os import fdopen
+import sys, os, json, traceback
+
+# now import the action as process input/output
+from main__ import main as main
+
+env = os.environ
+out = fdopen(3, "wb")
+while True:
+  line = stdin.readline()
+  if not line: break
+  args = json.loads(line)
+  payload = {}
+  for key in args:
+    if key == "value":
+      payload = args["value"]
+    else:
+      env["__OW_%s" % key.upper()]= args[key]
+  res = {}
+  try:
+    res = main(payload)
+  except Exception as ex:
+    print(traceback.format_exc(), file=stderr)
+    res = {"error": str(ex)}
+  out.write(json.dumps(res, ensure_ascii=False).encode('utf-8'))
+  out.write(b'\n')
+  stdout.flush()
+  stderr.flush()
+  out.flush()
diff --git a/actionloop-starter-kit/settings.gradle 
b/actionloop-starter-kit/settings.gradle
new file mode 100644
index 0000000..0bbce17
--- /dev/null
+++ b/actionloop-starter-kit/settings.gradle
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+include 'tests'
+include 'python3.7'
+
+rootProject.name = 'runtime-actionlooop'
+
+gradle.ext.openwhisk = [
+        version: '1.0.0-SNAPSHOT'
+]
+
+gradle.ext.scala = [
+    version: '2.11.8',
+    compileFlags: ['-feature', '-unchecked', '-deprecation', 
'-Xfatal-warnings', '-Ywarn-unused-import']
+]
+
+gradle.ext.scalafmt = [
+    version: '1.5.0',
+    config: new File(rootProject.projectDir, '.scalafmt.conf')
+]
+
diff --git a/actionloop-starter-kit/tests/build.gradle 
b/actionloop-starter-kit/tests/build.gradle
new file mode 100644
index 0000000..1ae5a4b
--- /dev/null
+++ b/actionloop-starter-kit/tests/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+apply plugin: 'scala'
+apply plugin: 'eclipse'
+compileTestScala.options.encoding = 'UTF-8'
+
+repositories {
+    mavenCentral()
+    mavenLocal()
+}
+
+tasks.withType(Test) {
+    testLogging {
+        events "passed", "skipped", "failed"
+        showStandardStreams = true
+        exceptionFormat = 'full'
+    }
+    outputs.upToDateWhen { false } // force tests to run every time
+}
+
+dependencies {
+    compile "org.scala-lang:scala-library:${gradle.scala.version}"
+    compile 
"org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:tests"
+    compile 
"org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:test-sources"
+}
+
+tasks.withType(ScalaCompile) {
+    scalaCompileOptions.additionalParameters = gradle.scala.compileFlags
+}
diff --git 
a/actionloop-starter-kit/tests/src/test/scala/runtime/actionContainers/ActionLoopPythonBasicTests.scala
 
b/actionloop-starter-kit/tests/src/test/scala/runtime/actionContainers/ActionLoopPythonBasicTests.scala
new file mode 100644
index 0000000..784dd15
--- /dev/null
+++ 
b/actionloop-starter-kit/tests/src/test/scala/runtime/actionContainers/ActionLoopPythonBasicTests.scala
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+package runtime.actionContainers
+
+import actionContainers.ActionContainer.withContainer
+import actionContainers.{ActionContainer, BasicActionRunnerTests}
+import common.WskActorSystem
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+class ActionLoopPythonBasicTests extends BasicActionRunnerTests with 
WskActorSystem {
+
+  val image = "actionloop-demo-python-v3.7"
+
+  override def withActionContainer(env: Map[String, String] = Map.empty)(
+    code: ActionContainer => Unit) = {
+    withContainer(image, env)(code)
+  }
+
+  def withActionLoopContainer(code: ActionContainer => Unit) =
+    withContainer(image)(code)
+
+  behavior of image
+
+  override val testNoSourceOrExec = TestConfig("")
+
+
+  override val testNotReturningJson =
+    TestConfig("""
+                 |def main(args):
+                 |    return "not a json object"
+               """.stripMargin)
+
+  override val testEcho = TestConfig(
+    """|import sys
+       |def main(args):
+       |   print("hello stdout", file=sys.stdout)
+       |   print("hello stderr", file=sys.stderr)
+       |   return args
+    """.stripMargin)
+
+  override val testUnicode = TestConfig(
+    """|def main(args):
+       |  delimiter = args['delimiter']
+       |  msg = u"%s ☃ %s" % (delimiter, delimiter)
+       |  print(msg)
+       |  return { "winter": msg }
+    """.stripMargin)
+
+  override val testEnv = TestConfig(
+    """|import os
+       |def main(args):
+       |  env = os.environ
+       |  return {
+       |    "api_host":      env["__OW_API_HOST"],
+       |    "api_key":       env["__OW_API_KEY"],
+       |    "namespace":     env["__OW_NAMESPACE"],
+       |    "activation_id": env["__OW_ACTIVATION_ID"],
+       |    "action_name":   env["__OW_ACTION_NAME"],
+       |    "deadline":      env["__OW_DEADLINE"]
+       |  }
+    """.stripMargin)
+
+
+  override val testInitCannotBeCalledMoreThanOnce = TestConfig(
+    s"""|def main(args):
+        |  return args
+    """.stripMargin)
+
+  override val testEntryPointOtherThanMain = TestConfig(
+    s"""|def niam(args):
+        |   return args
+    """.stripMargin, main = "niam")
+
+  override val testLargeInput = TestConfig(
+    s"""|def main(args):
+        |  return args
+    """.stripMargin)
+}
diff --git a/actionloop-starter-kit/tools/invoke.py 
b/actionloop-starter-kit/tools/invoke.py
new file mode 100755
index 0000000..68b2ca8
--- /dev/null
+++ b/actionloop-starter-kit/tools/invoke.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python
+"""Executable Python script for testing the action proxy.
+/*
+ * 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.
+ */
+
+  This script is useful for testing the action proxy (or its derivatives)
+  by simulating invoker interactions. Use it in combination with
+  docker run <image> which starts up the action proxy.
+  Example:
+     docker run -i -t -p 8080:8080 dockerskeleton # locally built images may 
be referenced without a tag
+     ./invoke.py init <action source file>
+     ./invoke.py run '{"some":"json object as a string"}'
+
+  For additional help, try ./invoke.py -h
+"""
+
+import os
+import re
+import sys
+import json
+import base64
+import requests
+import codecs
+import argparse
+try:
+    import argcomplete
+except ImportError:
+    argcomplete = False
+
+def main():
+    try:
+        args = parseArgs()
+        exitCode = {
+            'init' : init,
+            'run'   : run
+        }[args.cmd](args)
+    except Exception as e:
+        print(e)
+        exitCode = 1
+    sys.exit(exitCode)
+
+def dockerHost():
+    dockerHost = 'localhost'
+    if 'DOCKER_HOST' in os.environ:
+        try:
+            dockerHost = 
re.compile('tcp://(.*):[\d]+').findall(os.environ['DOCKER_HOST'])[0]
+        except Exception:
+            print('cannot determine docker host from %s' % 
os.environ['DOCKER_HOST'])
+            sys.exit(-1)
+    return dockerHost
+
+def containerRoute(args, path):
+    return 'http://%s:%s/%s' % (args.host, args.port, path)
+
+def parseArgs():
+    parser = argparse.ArgumentParser(description='initialize and run an 
OpenWhisk action container')
+    parser.add_argument('-v', '--verbose', help='verbose output', 
action='store_true')
+    parser.add_argument('--host', help='action container host', 
default=dockerHost())
+    parser.add_argument('-p', '--port', help='action container port number', 
default=8080, type=int)
+
+    subparsers = parser.add_subparsers(title='available commands', dest='cmd')
+
+    initmenu = subparsers.add_parser('init', help='initialize container with 
src or zip/tgz file')
+    initmenu.add_argument('-b', '--binary', help='treat artifact as binary', 
action='store_true')
+    initmenu.add_argument('main', nargs='?', default='main', help='name of the 
"main" entry method for the action')
+    initmenu.add_argument('artifact', help='a source file or zip/tgz archive')
+
+    runmenu = subparsers.add_parser('run', help='send arguments to container 
to run action')
+    runmenu.add_argument('payload', nargs='?', help='the arguments to send to 
the action, either a reference to a file or an inline JSON object', 
default=None)
+
+    if argcomplete:
+        argcomplete.autocomplete(parser)
+    return parser.parse_args()
+
+def init(args):
+    main = args.main
+    artifact = args.artifact
+
+    if artifact and (args.binary or artifact.endswith('.zip') or 
artifact.endswith('tgz') or artifact.endswith('jar')):
+        with open(artifact, 'rb') as fp:
+            contents = fp.read()
+        contents = base64.b64encode(contents)
+        binary = True
+    elif artifact is not '':
+        with(codecs.open(artifact, 'r', 'utf-8')) as fp:
+            contents = fp.read()
+        binary = False
+    else:
+        contents = None
+        binary = False
+
+    r = requests.post(
+        containerRoute(args, 'init'),
+        json = {"value": {"code": contents,
+                          "binary": binary,
+                          "main": main}})
+    print(r.text)
+
+def run(args):
+    value = processPayload(args.payload)
+    if args.verbose:
+        print('Sending value: %s...' % json.dumps(value)[0:40])
+    r = requests.post(containerRoute(args, 'run'), json = {"value": value})
+    print(r.text)
+
+def processPayload(payload):
+    if payload and os.path.exists(payload):
+        with open(payload) as fp:
+            return json.load(fp)
+    try:
+        d = json.loads(payload if payload else '{}')
+        if isinstance(d, dict):
+            return d
+        else:
+            raise
+    except:
+        print('payload must be a JSON object.')
+        sys.exit(-1)
+
+if __name__ == '__main__':
+    main()
diff --git a/actionloop-starter-kit/tools/travis/build.sh 
b/actionloop-starter-kit/tools/travis/build.sh
new file mode 100755
index 0000000..e3aa931
--- /dev/null
+++ b/actionloop-starter-kit/tools/travis/build.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -ex
+
+# Build script for Travis-CI.
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+WHISKDIR="$ROOTDIR/../openwhisk"
+UTILDIR="$ROOTDIR/../incubator-openwhisk-utilities"
+
+export OPENWHISK_HOME=$WHISKDIR
+
+# run scancode using the ASF Release configuration
+cd $UTILDIR
+scancode/scanCode.py --config scancode/ASF-Release.cfg $ROOTDIR
+
+# Build OpenWhisk deps before we run tests
+cd $WHISKDIR
+TERM=dumb ./gradlew install
+# Mock file (works around bug upstream)
+echo "openwhisk.home=$WHISKDIR" > whisk.properties
+echo "vcap.services.file=" >> whisk.properties
+
+# Build runtime
+cd $ROOTDIR
+TERM=dumb ./gradlew distDocker
diff --git a/actionloop-starter-kit/tools/travis/publish.sh 
b/actionloop-starter-kit/tools/travis/publish.sh
new file mode 100755
index 0000000..e18795d
--- /dev/null
+++ b/actionloop-starter-kit/tools/travis/publish.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -eux
+
+# Build script for Travis-CI.
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+WHISKDIR="$ROOTDIR/../openwhisk"
+
+export OPENWHISK_HOME=$WHISKDIR
+
+IMAGE_PREFIX=$1
+RUNTIME_VERSION=$2
+IMAGE_TAG=$3
+
+if [ ${RUNTIME_VERSION} == "2" ]; then
+  RUNTIME="python2Action"
+elif [ ${RUNTIME_VERSION} == "3" ]; then
+  RUNTIME="pythonAction"
+elif [ ${RUNTIME_VERSION} == "3-ai" ]; then
+  RUNTIME="python3AiAction"
+elif [ ${RUNTIME_VERSION} == "3-loop" ]; then
+  RUNTIME="pythonActionLoop"
+fi
+
+if [[ ! -z ${DOCKER_USER} ]] && [[ ! -z ${DOCKER_PASSWORD} ]]; then
+docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
+fi
+
+if [[ ! -z ${RUNTIME} ]]; then
+TERM=dumb ./gradlew \
+:core:${RUNTIME}:distDocker \
+-PdockerRegistry=docker.io \
+-PdockerImagePrefix=${IMAGE_PREFIX} \
+-PdockerImageTag=${IMAGE_TAG}
+
+  # if doing latest also push a tag with the hash commit
+  if [ ${IMAGE_TAG} == "latest" ]; then
+  SHORT_COMMIT=`git rev-parse --short HEAD`
+  TERM=dumb ./gradlew \
+  :core:${RUNTIME}:distDocker \
+  -PdockerRegistry=docker.io \
+  -PdockerImagePrefix=${IMAGE_PREFIX} \
+  -PdockerImageTag=${SHORT_COMMIT}
+  fi
+
+fi
diff --git a/actionloop-starter-kit/tools/travis/setup.sh 
b/actionloop-starter-kit/tools/travis/setup.sh
new file mode 100755
index 0000000..3424cdb
--- /dev/null
+++ b/actionloop-starter-kit/tools/travis/setup.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -e
+
+# Build script for Travis-CI.
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+HOMEDIR="$SCRIPTDIR/../../../"
+
+# clone OpenWhisk utilities repo. in order to run scanCode
+cd $HOMEDIR
+git clone https://github.com/apache/incubator-openwhisk-utilities.git
+
+# clone main openwhisk repo. for testing purposes
+git clone --depth=1 https://github.com/apache/incubator-openwhisk.git openwhisk
+cd openwhisk
+./tools/travis/setup.sh
diff --git a/actionloop-starter-kit/tools/travis/test.sh 
b/actionloop-starter-kit/tools/travis/test.sh
new file mode 100755
index 0000000..7ba1b89
--- /dev/null
+++ b/actionloop-starter-kit/tools/travis/test.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -ex
+
+# Build script for Travis-CI.
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+WHISKDIR="$ROOTDIR/../openwhisk"
+
+export OPENWHISK_HOME=$WHISKDIR
+cd ${ROOTDIR}
+TERM=dumb ./gradlew :tests:checkScalafmtAll
+TERM=dumb ./gradlew :tests:testPython3

Reply via email to