diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..eaee7751fb0533af8a986877a151e6dc5762fa10 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +sudo: required +group: deprecated-2017Q3 +language: scala +scala: +- 2.11.8 +services: +- docker +before_install: +- "./tools/travis/setup.sh" +install: true +script: +- "./tools/travis/build.sh && ./tools/travis/deploy.sh && ./tools/travis/test.sh" +deploy: +- provider: script + script: "./tools/travis/publish.sh csantanapr ${TRAVIS_TAG%@*} ${TRAVIS_TAG##*@}" + on: + tags: true + all_branches: true +env: + global: + - secure: ekeKM0bPtGx051FdMOUmqK8yDGQGlyGkJeMU+PAzwWf2XBGzl3SQijOse6uRpyMT/ik3V4rO3CsW+Bdlsu50ylF8nKGVtTpuISTetUCtDHg6m8Fwro//JeXHi3ufJaHtNNos5m8ZmX8rkGZLLSsIwrNQzYHHfiqDhdAL642snLfk3qddjjRBdYD7jGQBr6EwVu5sEORmDJf63I4wwW8fI7olBtIa4W1xW/2dZGoxNU984ypOzG0yoerxgxsuD1ZchS9R93NEG8kcQLpmzqYMFN9XguqXWdp4f8ImbSIGQ0ANDtHIGs+7ZX56fuDA0VsDwK9OCIfG1ZrsO94/fdb/sbSKKuYc0u4l5SVx+n6gdttikGJT6IMM2kRQ5eT/SbJiZshyLkB117IVq3JHTIS3alDSIchFP589sVxfAVzZJ89p5cq7g2JU+weObgxd6Tp/rkEjF5Obo2/5iFf+J5Lf56Ei83SnmYeu7maAzIv+fLzTONymWpCwOtQcif4LeiMNTUdgYtHRBKRCFaMEuOaGi20YuIyoy+OULM/KUFDHwIJROkNFZ+SQ19Jx0qQOIY85E8+D4JBLcXp8VZVGMY+ZnoE76ih/WZZ8wl3zwq0+l53sYhOWUfo5fFSxqg5Ac6gG9OTeO4PmmV/m7ZKdFWFbGbB4qhBq+4swsVpOR+cMuUQ= + - secure: dMiAsOrklxVR/tkyM11pibEpqdz1qEjziDU1slIYCG4PFRmX9DC9s+fe5gnOCLhyXmt0khz+MG5Pg9bjOma06XbaUAxPvQ+pAf1/OO/e96VLLEo7Bz4jY8qJlvQTfDbAJFlmXOThNu81uNWAvccb+7+Bf/26UOH5vmAvpdIGTsudU1kmC4C+WYRNjtY0us1OPP6jabKZ7jCnQ8m5rAaUPAwuyiwKPEM+Uk0Yo0SvyiMyxihJIJnPi3kT7D0wqQdq9l9WGWSJRCnu6sRpc/VFDRfIcAnxVrg/AuGRxXedO8QdJvJTugxmIxbwB3bYGHZBfHIQkiQfo+7urWXpApNr5ytUjMm0u6ktb53zjhGm2T16Ow04DByT8FWyMnak+ekyV2v7E037Gdq28SgclbZTTJYMtix0rylt/d70upsDbiOKulxWhhIIv1+qZa9kaclW/FXe+0VziSSspJv6ZzXe1DBEpi/W3dm6/GUzbm41h/5agnvCspJ7itsksaXOwCDB3jSCMcqpW9JiLjDyVklycF9QsGUPOa9hOA3eTve2Y3G3ToPFG7tCZYj/SbN6Cm6jpuFcczjT/Lps8XNg0jDcpfZJYP+vWiPa/4vJdo/NAvOdr+VesxAC/2BIGu4OSBi/ayXeEDa8QEen7BCmfYWAtkTsKhO6JNx81e1KekT802o= diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1585e8d7edfcf9ec127d9483c0d41a5be27b270f --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# Apache OpenWhisk runtimes for swift +[](https://travis-ci.org/apache/incubator-openwhisk-runtime-python) + + +### Give it a try today +To use as a docker action using python 3 +``` +wsk action update myAction myAction.py --docker openwhisk/python3action:1.0.0 +``` +Replace `python3ction` with `python2acton` to use python 2. + + +### To use on deployment that contains the rutime as a kind +To use as a kind action using python 3 +``` +wsk action update myAction myAction.swift --kind python:3 +``` +Replace `python:3` with `python:2` to use python 2. + + +### Local development +``` +./gradlew core:pythonAction:distDocker +``` +This will produce the image `whisk/python3action` + +Build and Push image +``` +docker login +./gradlew core:pythonAction:distDocker -PdockerImagePrefix=$prefix-user -PdockerRegistry=docker.io +``` +Replace `core:pythonAction` with `core:python2Action` to build python 2 instead. + +Deploy OpenWhisk using ansible environment that contains the kind `python:3` and `python:2` +Assuming you have OpenWhisk already deploy localy and `OPENWHISK_HOME` pointing to root directory of OpenWhisk core repository. + +Set `ROOTDIR` to the root directory of this repository. + +Redeploy OpenWhisk +``` +cd $OPENWHISK_HOME/ansible +ANSIBLE_CMD="ansible-playbook -i ${ROOTDIR}/ansible/environments/local" +$ANSIBLE_CMD setup.yml +$ANSIBLE_CMD couchdb.yml +$ANSIBLE_CMD initdb.yml +$ANSIBLE_CMD wipe.yml +$ANSIBLE_CMD openwhisk.yml +``` + +Or you can use `wskdev` and create a soft link to the target ansible environment, for example: +``` +ln -s ${ROOTDIR}/ansible/environments/local ${OPENWHISK_HOME}/ansible/environments/local-python +wskdev fresh -t local-python +``` + +To use as docker action push to your own dockerhub account +``` +docker tag whisk/python3action $user_prefix/python +docker push $user_prefix/python3action +``` +Then create the action using your the image from dockerhub +``` +wsk action update myAction myAction.py --docker $user_prefix/python3action +``` +The `$user_prefix` is usually your dockerhub user id. +Replace `python3action` with `python2action` to use python 2 + + + +# License +[Apache 2.0](LICENSE.txt) + + diff --git a/ansible/environments/local/group_vars/all b/ansible/environments/local/group_vars/all new file mode 100755 index 0000000000000000000000000000000000000000..2b82ecd676a05860772aa8cb8a4b83772493f153 --- /dev/null +++ b/ansible/environments/local/group_vars/all @@ -0,0 +1,52 @@ +whisk_version_name: local +config_root_dir: /tmp +whisk_logs_dir: /tmp/wsklogs +docker_registry: "" +docker_dns: "" + +db_prefix: whisk_local_ + +# Auto lookup to find the db credentials +db_provider: "{{ lookup('ini', 'db_provider section=db_creds file={{ playbook_dir }}/db_local.ini') }}" +db_username: "{{ lookup('ini', 'db_username section=db_creds file={{ playbook_dir }}/db_local.ini') }}" +db_password: "{{ lookup('ini', 'db_password section=db_creds file={{ playbook_dir }}/db_local.ini') }}" +db_protocol: "{{ lookup('ini', 'db_protocol section=db_creds file={{ playbook_dir }}/db_local.ini') }}" +db_host: "{{ lookup('ini', 'db_host section=db_creds file={{ playbook_dir }}/db_local.ini') }}" +db_port: "{{ lookup('ini', 'db_port section=db_creds file={{ playbook_dir }}/db_local.ini') }}" + +# API GW connection configuration +apigw_auth_user: "" +apigw_auth_pwd: "" +apigw_host_v2: "http://{{ groups['apigateway']|first }}:{{apigateway.port.api}}/v2" + +controller_arguments: '-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098' +invoker_arguments: "{{ controller_arguments }}" + +invoker_allow_multiple_instances: true + +runtimes_manifest: + defaultImagePrefix: "openwhisk" + defaultImageTag: "latest" + runtimes: + nodejs: + - kind: "nodejs:6" + default: true + image: + name: "nodejs6action" + deprecated: false + python: + - kind: "python" + image: + name: "python2action" + deprecated: false + - kind: "python:2" + default: true + image: + name: "python2action" + deprecated: false + - kind: "python:3" + image: + name: "python3action" + deprecated: false + blackboxes: + - name: "dockerskeleton" diff --git a/ansible/environments/local/hosts b/ansible/environments/local/hosts new file mode 100644 index 0000000000000000000000000000000000000000..c99f195f4aea2a7eda0f842984045fb335ba8708 --- /dev/null +++ b/ansible/environments/local/hosts @@ -0,0 +1,26 @@ +; the first parameter in a host is the inventory_hostname + +; used for local actions only +ansible ansible_connection=local + +[edge] +172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local + +[controllers] +controller0 ansible_host=172.17.0.1 ansible_connection=local + +[kafka] +172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local + +[invokers] +invoker0 ansible_host=172.17.0.1 ansible_connection=local + +; db group is only used if db_provider is CouchDB +[db] +172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local + +[redis] +172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local + +[apigateway] +172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local diff --git a/core/python2Action/CHANGELOG.md b/core/python2Action/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..5905061a1fb32149f7a0e2d8b06171c9a92cf372 --- /dev/null +++ b/core/python2Action/CHANGELOG.md @@ -0,0 +1,49 @@ +# Python 2 OpenWhisk Runtime Container + + + +## 1.0.0 +Change: Initial release + +Python version = 2.7.12 + +- asn1crypto (0.22.0) +- attrs (17.2.0) +- beautifulsoup4 (4.5.1) +- cffi (1.10.0) +- click (6.7) +- cryptography (2.0.3) +- cssselect (1.0.1) +- enum34 (1.1.6) +- Flask (0.11.1) +- gevent (1.1.2) +- greenlet (0.4.12) +- httplib2 (0.9.2) +- idna (2.6) +- ipaddress (1.0.18) +- itsdangerous (0.24) +- Jinja2 (2.9.6) +- kafka-python (1.3.1) +- lxml (3.6.4) +- MarkupSafe (1.0) +- parsel (1.2.0) +- pip (9.0.1) +- pyasn1 (0.3.3) +- pyasn1-modules (0.1.1) +- pycparser (2.18) +- PyDispatcher (2.0.5) +- pyOpenSSL (17.2.0) +- python-dateutil (2.5.3) +- queuelib (1.4.2) +- requests (2.11.1) +- Scrapy (1.1.2) +- service-identity (17.0.0) +- setuptools (36.4.0) +- simplejson (3.8.2) +- six (1.10.0) +- Twisted (16.4.0) +- virtualenv (15.1.0) +- w3lib (1.18.0) +- Werkzeug (0.12.2) +- wheel (0.29.0) +- zope.interface (4.4.2) diff --git a/core/actionProxy/actionproxy.py b/core/python2Action/actionproxy.py similarity index 100% rename from core/actionProxy/actionproxy.py rename to core/python2Action/actionproxy.py diff --git a/core/python2Action/build.gradle b/core/python2Action/build.gradle index a7a3f61e65a37fd6b811d2daf98177e039338620..ca5fb2f6aee8c975a32d17aa286395fba4205c0f 100644 --- a/core/python2Action/build.gradle +++ b/core/python2Action/build.gradle @@ -4,7 +4,6 @@ distDocker.dependsOn 'copyFiles' distDocker.finalizedBy 'rmFiles' def runners = files( - new File(project(':core:actionProxy').projectDir, 'actionproxy.py'), new File(project(':core:pythonAction').projectDir, 'pythonrunner.py') ) diff --git a/core/actionProxy/invoke.py b/core/python2Action/invoke.py similarity index 100% rename from core/actionProxy/invoke.py rename to core/python2Action/invoke.py diff --git a/core/pythonAction/CHANGELOG.md b/core/pythonAction/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..278e93ebab0a923f5a5a5ba07c918a7a77a8ac90 --- /dev/null +++ b/core/pythonAction/CHANGELOG.md @@ -0,0 +1,50 @@ +# Python 3 OpenWhisk Runtime Container + + + +## 1.0.0 +Change: Initial release + +Python version = 3.6.1 + +- asn1crypto (0.23.0) +- attrs (17.2.0) +- Automat (0.6.0) +- beautifulsoup4 (4.5.3) +- cffi (1.11.1) +- click (6.7) +- constantly (15.1.0) +- cryptography (2.0.3) +- cssselect (1.0.1) +- Flask (0.12) +- gevent (1.2.1) +- greenlet (0.4.12) +- httplib2 (0.10.3) +- idna (2.6) +- incremental (17.5.0) +- itsdangerous (0.24) +- Jinja2 (2.9.6) +- kafka-python (1.3.4) +- lxml (3.7.3) +- MarkupSafe (1.0) +- parsel (1.2.0) +- pip (9.0.1) +- pyasn1 (0.3.7) +- pyasn1-modules (0.1.4) +- pycparser (2.18) +- PyDispatcher (2.0.5) +- pyOpenSSL (17.3.0) +- python-dateutil (2.6.0) +- queuelib (1.4.2) +- requests (2.13.0) +- Scrapy (1.3.3) +- service-identity (17.0.0) +- setuptools (36.5.0) +- simplejson (3.10.0) +- six (1.11.0) +- Twisted (17.1.0) +- virtualenv (15.1.0) +- w3lib (1.18.0) +- Werkzeug (0.12.2) +- wheel (0.29.0) +- zope.interface (4.4.3) diff --git a/core/pythonAction/Dockerfile b/core/pythonAction/Dockerfile index 1c1345c6e175ca364661d729f39e26643b223f9d..017df095fd804a58e7ee5dadf94cbeaf0cfe1974 100644 --- a/core/pythonAction/Dockerfile +++ b/core/pythonAction/Dockerfile @@ -1,5 +1,5 @@ # Dockerfile for python actions, overrides and extends ActionRunner from actionProxy -FROM dockerskeleton +FROM openwhisk/dockerskeleton:1.0.0 RUN apk add --no-cache \ bzip2-dev \ diff --git a/core/pythonAction/build.gradle b/core/pythonAction/build.gradle index 0149b7093cb9266b69a0f5f41a40ad4d0064bb6a..f3a57241d2295020100569f00e433dd6bbe5c8ae 100644 --- a/core/pythonAction/build.gradle +++ b/core/pythonAction/build.gradle @@ -1,3 +1,2 @@ ext.dockerImageName = 'python3action' apply from: '../../gradle/docker.gradle' -distDocker.dependsOn ':core:actionProxy:distDocker' diff --git a/settings.gradle b/settings.gradle index 9a27b319b4d55f2a2ff80b290f2e9f3c3b3d139e..09cf4fa76509eadc27c656a99e6737bb7e0cbe71 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,26 +1,17 @@ -include 'common:scala' +def owPath = System.getenv("OPENWHISK_HOME") ?: '../open' +def owDirectory = new File(owPath) -include 'core:controller' -include 'core:invoker' -include 'core:nodejsActionBase' -include 'core:nodejs6Action' -include 'core:actionProxy' -include 'core:pythonAction' -include 'core:python2Action' -include 'core:swift3Action' -include 'core:swift3.1.1Action' -include 'core:javaAction' -include 'core:php7.1Action' - -include 'tools:cli' - -include 'sdk:docker' +include 'common:scala'; project(':common:scala').projectDir = new File(owDirectory, 'common/scala') +include 'core:controller'; project(':core:controller').projectDir = new File(owDirectory, 'core/controller') +include 'core:invoker'; project(':core:invoker').projectDir = new File(owDirectory, 'core/invoker') +include 'whisktests'; project(':whisktests').projectDir = new File(owDirectory, 'tests') include 'tests' -include 'tests:dat:blackbox:badaction' -include 'tests:dat:blackbox:badproxy' -rootProject.name = 'openwhisk' +include 'core:pythonAction' +include 'core:python2Action' + +rootProject.name = 'runtime-python' gradle.ext.scala = [ version: '2.11.8', diff --git a/tests/build.gradle b/tests/build.gradle index 6fa5a66e53e92ee4cfcc1c9ef8ee9d2637457689..124229c2932703c1b0325d5cef0c084031d1c33e 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'scala' apply plugin: 'eclipse' compileTestScala.options.encoding = 'UTF-8' +evaluationDependsOn(':whisktests') + repositories { mavenCentral() } tasks.withType(Test) { - systemProperties(System.getProperties()) - testLogging { events "passed", "skipped", "failed" showStandardStreams = true @@ -17,63 +17,12 @@ tasks.withType(Test) { outputs.upToDateWhen { false } // force tests to run every time } -task testLean(type: Test) { - exclude '**/*Swift*' - exclude '**/*Python*' - exclude '**/*Java*' - exclude '**/*ThrottleTests*' - exclude '**/MaxActionDurationTests*' - exclude '**/*ApiGwTests*' -} - -// Add all images needed for local testing here -test.dependsOn([ - ':core:nodejs6Action:distDocker', - ':core:actionProxy:distDocker', - ':core:pythonAction:distDocker', - ':core:python2Action:distDocker', - ':core:javaAction:distDocker', - ':core:swift3Action:distDocker', - ':core:swift3.1.1Action:distDocker', - ':sdk:docker:distDocker', - ':tests:dat:blackbox:badaction:distDocker', - ':tests:dat:blackbox:badproxy:distDocker' -]) - dependencies { compile "org.scala-lang:scala-library:${gradle.scala.version}" - compile 'org.apache.commons:commons-lang3:3.3.2' - compile 'org.apache.httpcomponents:httpclient:4.5.2:tests' - compile 'org.apache.httpcomponents:httpmime:4.3.6' - compile 'junit:junit:4.11' - compile 'com.jayway.restassured:rest-assured:2.6.0' - compile 'org.scalatest:scalatest_2.11:3.0.1' - compile 'com.typesafe.akka:akka-testkit_2.11:2.5.4' - compile 'com.google.code.gson:gson:2.3.1' - compile 'org.scalamock:scalamock-scalatest-support_2.11:3.4.2' - compile 'com.typesafe.akka:akka-testkit_2.11:2.4.16' - compile 'com.typesafe.akka:akka-http-testkit_2.11:10.0.10' - compile 'com.github.java-json-tools:json-schema-validator:2.2.8'; - - compile project(':common:scala') - compile project(':core:controller') - compile project(':core:invoker') + compile project(':whisktests') + compile project(':whisktests').sourceSets.test.output } tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = gradle.scala.compileFlags } - -def keystorePath = new File(sourceSets.test.scala.outputDir, 'keystore') -task deleteKeystore(type: Delete) { - delete keystorePath -} -task createKeystore(dependsOn: deleteKeystore) { - doLast { - Properties props = new Properties() - props.load(new FileInputStream(file('../whisk.properties'))) - def cmd = ['keytool', '-import', '-alias', 'Whisk', '-noprompt', '-trustcacerts', '-file', file(props['whisk.ssl.cert']), '-keystore', keystorePath, '-storepass', 'openwhisk'] - cmd.execute().waitForProcessOutput(System.out, System.err) - } -} -compileTestScala.finalizedBy createKeystore diff --git a/tests/src/test/scala/actionContainers/ActionContainer.scala b/tests/src/test/scala/actionContainers/ActionContainer.scala index 94f6763e745e00cc40187a8eb4e8ac1f3230526a..56aa1314022ec66a970cc8cec88eaaf8607d2d41 100644 --- a/tests/src/test/scala/actionContainers/ActionContainer.scala +++ b/tests/src/test/scala/actionContainers/ActionContainer.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package actionContainers +package runtime.actionContainers import java.io.ByteArrayOutputStream import java.io.File diff --git a/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala b/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala index 1ec8e9f89b129ee7c264188df870fdb49a52ec61..1471d1218569b192ded3646e85d4b9b4b4e29dce 100644 --- a/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala +++ b/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package actionContainers +package runtime.actionContainers import java.io.File import java.util.Base64 diff --git a/tests/src/test/scala/actionContainers/Python2ActionContainerTests.scala b/tests/src/test/scala/actionContainers/Python2ActionContainerTests.scala index 1740401f35d92a0a5a762e0174520ed4db6c8b65..312361d651e2f67870e10570ac1d86ac194fce74 100644 --- a/tests/src/test/scala/actionContainers/Python2ActionContainerTests.scala +++ b/tests/src/test/scala/actionContainers/Python2ActionContainerTests.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package actionContainers +package runtime.actionContainers import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/tests/src/test/scala/actionContainers/PythonActionContainerTests.scala b/tests/src/test/scala/actionContainers/PythonActionContainerTests.scala index 1e4f1bc480bc02add0c4a938bee644cbbc408aa5..afabc3e9d41afa2efe5c6741dc1bfd1ade9c75a7 100644 --- a/tests/src/test/scala/actionContainers/PythonActionContainerTests.scala +++ b/tests/src/test/scala/actionContainers/PythonActionContainerTests.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package actionContainers +package runtime.actionContainers import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/tests/src/test/scala/actionContainers/ResourceHelpers.scala b/tests/src/test/scala/actionContainers/ResourceHelpers.scala index 3041e0ea4aecd594be023107f88fd412987a16be..08f46e4f81e6e3160606e8f9242a3162829f0047 100644 --- a/tests/src/test/scala/actionContainers/ResourceHelpers.scala +++ b/tests/src/test/scala/actionContainers/ResourceHelpers.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package actionContainers +package runtime.actionContainers import java.net.URI import java.net.URLClassLoader diff --git a/tools/travis/build.sh b/tools/travis/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..aacbf95eb2502fd911a93024ce3180bbf2533ec0 --- /dev/null +++ b/tools/travis/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -ex + +# Build script for Travis-CI. + +SCRIPTDIR=$(cd $(dirname "$0") && pwd) +ROOTDIR="$SCRIPTDIR/../.." +WHISKDIR="$ROOTDIR/../openwhisk" + +export OPENWHISK_HOME=$WHISKDIR + +IMAGE_PREFIX="testing" + +# Build runtime +cd $ROOTDIR +TERM=dumb ./gradlew \ +:core:python2Action:distDocker :core:pythonAction:distDocker \ +-PdockerImagePrefix=${IMAGE_PREFIX} + + +# Build OpenWhisk +cd $WHISKDIR + +#pull down images +docker pull openwhisk/controller +docker tag openwhisk/controller ${IMAGE_PREFIX}/controller +docker pull openwhisk/invoker +docker tag openwhisk/invoker ${IMAGE_PREFIX}/invoker +docker pull openwhisk/nodejs6action +docker tag openwhisk/nodejs6action ${IMAGE_PREFIX}/nodejs6action + +#Build CLI +TERM=dumb ./gradlew \ +:tools:cli:distDocker \ +-PdockerImagePrefix=${IMAGE_PREFIX} + + + diff --git a/tools/travis/deploy.sh b/tools/travis/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..bf300634af4f776330090fd6086e9334eef9940b --- /dev/null +++ b/tools/travis/deploy.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -ex + +# Build script for Travis-CI. + +SCRIPTDIR=$(cd $(dirname "$0") && pwd) +ROOTDIR="$SCRIPTDIR/../.." +WHISKDIR="$ROOTDIR/../openwhisk" + +export OPENWHISK_HOME=$WHISKDIR + +IMAGE_PREFIX="testing" + +# Deploy OpenWhisk +cd $WHISKDIR/ansible +ANSIBLE_CMD="ansible-playbook -i ${ROOTDIR}/ansible/environments/local -e docker_image_prefix=${IMAGE_PREFIX}" +$ANSIBLE_CMD setup.yml +$ANSIBLE_CMD prereq.yml +$ANSIBLE_CMD couchdb.yml +$ANSIBLE_CMD initdb.yml +$ANSIBLE_CMD wipe.yml +$ANSIBLE_CMD openwhisk.yml + +docker images +docker ps + +cat $WHISKDIR/whisk.properties +curl -s -k https://172.17.0.1 | jq . +curl -s -k https://172.17.0.1/api/v1 | jq . + +#Deployment +WHISK_APIHOST="172.17.0.1" +WHISK_AUTH=`cat ${WHISKDIR}/ansible/files/auth.guest` +WHISK_CLI="${WHISKDIR}/bin/wsk -i" + +${WHISK_CLI} property set --apihost ${WHISK_APIHOST} --auth ${WHISK_AUTH} +${WHISK_CLI} property get + + diff --git a/tools/travis/publish.sh b/tools/travis/publish.sh new file mode 100755 index 0000000000000000000000000000000000000000..842970cc0f3332d782f6890a6c4b712863740e36 --- /dev/null +++ b/tools/travis/publish.sh @@ -0,0 +1,32 @@ +#!/bin/bash +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" +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} +fi diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh new file mode 100755 index 0000000000000000000000000000000000000000..adf859afa6653df959807f44aba04aed19ea32b0 --- /dev/null +++ b/tools/travis/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +# Build script for Travis-CI. + +SCRIPTDIR=$(cd $(dirname "$0") && pwd) +ROOTDIR="$SCRIPTDIR/../.." +HOMEDIR="$SCRIPTDIR/../../../" + +# OpenWhisk stuff +cd $HOMEDIR +git clone --depth=1 https://github.com/apache/incubator-openwhisk.git openwhisk +cd openwhisk +./tools/travis/setup.sh + diff --git a/tools/travis/test.sh b/tools/travis/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..226c62e54bd0e2783bb65447c293cdcf045b271e --- /dev/null +++ b/tools/travis/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +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:test --tests *Python*Tests + + +