openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From japet...@apache.org
Subject [incubator-openwhisk-runtime-nodejs] branch master updated: Add support for NodeJS10 (#98)
Date Wed, 07 Nov 2018 14:56:54 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new e892cd8  Add support for NodeJS10 (#98)
e892cd8 is described below

commit e892cd8e9eb71e3c45f23e4edafc0bec06038786
Author: Carlos Santana <csantanapr@apache.org>
AuthorDate: Wed Nov 7 09:56:50 2018 -0500

    Add support for NodeJS10 (#98)
    
    * add initial support for NodeJS10
    
    * fix scala class names
---
 .travis.yml                                        |  2 +-
 README.md                                          |  6 +++
 core/nodejs10Action/.dockerignore                  |  8 ++++
 core/nodejs10Action/CHANGELOG.md                   | 28 +++++++++++++
 core/nodejs10Action/Dockerfile                     | 30 +++++++++++++
 .../nodejs10Action/build.gradle                    | 49 ++++++++++++++--------
 core/nodejs10Action/package.json                   | 16 +++++++
 settings.gradle                                    |  2 +
 tests/dat/docker/nodejs10docker/Dockerfile         |  3 ++
 .../docker/nodejs10docker/build.gradle}            | 12 +-----
 tests/dat/docker/nodejs10docker/package.json       |  8 ++++
 ...ts.scala => NodeJs10ActionContainerTests.scala} |  6 +--
 ...ntTests.scala => NodeJs10ConcurrentTests.scala} |  4 +-
 ...entTests.scala => NodeJs6ConcurrentTests.scala} |  2 +-
 ...entTests.scala => NodeJs8ConcurrentTests.scala} |  2 +-
 tools/travis/publish.sh                            |  2 +
 16 files changed, 144 insertions(+), 36 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 4a14bb5..17ed9c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,7 +41,7 @@ deploy:
       all_branches: true
       repo: apache/incubator-openwhisk-runtime-nodejs
   - provider: script
-    script: "./tools/travis/publish.sh openwhisk 6 latest && ./tools/travis/publish.sh
openwhisk 8 latest"
+    script: "./tools/travis/publish.sh openwhisk 6 latest && ./tools/travis/publish.sh
openwhisk 8 latest && ./tools/travis/publish.sh openwhisk 10 latest"
     on:
       branch: master
       repo: apache/incubator-openwhisk-runtime-nodejs
diff --git a/README.md b/README.md
index bc07c05..e3f7714 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,12 @@ For Node.js 8
 ```
 This will produce the image `whisk/action-nodejs-v8`
 
+For Node.js 10
+```
+./gradlew core:nodejs10Action:distDocker
+```
+This will produce the image `whisk/action-nodejs-v10`
+
 
 Build and Push image for Node.js 6
 ```
diff --git a/core/nodejs10Action/.dockerignore b/core/nodejs10Action/.dockerignore
new file mode 100644
index 0000000..3081e3e
--- /dev/null
+++ b/core/nodejs10Action/.dockerignore
@@ -0,0 +1,8 @@
+node_modules
+package-lock.json
+Dockerfile
+build.gradle
+.project
+.settings
+build.xml
+logs
\ No newline at end of file
diff --git a/core/nodejs10Action/CHANGELOG.md b/core/nodejs10Action/CHANGELOG.md
new file mode 100644
index 0000000..b425ed1
--- /dev/null
+++ b/core/nodejs10Action/CHANGELOG.md
@@ -0,0 +1,28 @@
+<!--
+#
+# 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.
+#
+-->
+
+# NodeJS 10 OpenWhisk Runtime Container
+
+## Apache 1.13 (next release)
+Changes:
+- Initial version with NodejS10 LTS
+
+- [openwhisk v3.18.0](https://www.npmjs.com/package/openwhisk) - JavaScript client library
for the OpenWhisk platform. Provides a wrapper around the OpenWhisk APIs.
+
+Node.js version = [10.13.0](https://nodejs.org/en/blog/release/v10.13.0/)
diff --git a/core/nodejs10Action/Dockerfile b/core/nodejs10Action/Dockerfile
new file mode 100644
index 0000000..8fdb165
--- /dev/null
+++ b/core/nodejs10Action/Dockerfile
@@ -0,0 +1,30 @@
+#
+# 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 node:10.13.0
+RUN apt-get update && apt-get install -y \
+    imagemagick \
+    unzip \
+    && rm -rf /var/lib/apt/lists/*
+WORKDIR /nodejsAction
+COPY . .
+# COPY the package.json to root container, so we can install npm packages a level up from
user's packages, so user's packages take precedence
+COPY ./package.json /
+RUN cd / && npm install --no-package-lock \
+    && npm cache clean --force
+EXPOSE 8080
+CMD node --expose-gc app.js
diff --git a/settings.gradle b/core/nodejs10Action/build.gradle
similarity index 51%
copy from settings.gradle
copy to core/nodejs10Action/build.gradle
index 9f55aa6..3d9314a 100644
--- a/settings.gradle
+++ b/core/nodejs10Action/build.gradle
@@ -15,26 +15,39 @@
  * limitations under the License.
  */
 
-include 'tests'
+apply plugin: 'eclipse'
+eclipse {
+    project {
+        natures 'org.eclipse.wst.jsdt.core.jsNature'
+        buildCommand 'org.eclipse.wst.jsdt.core.javascriptValidator'
+    }
+}
 
-include 'core:nodejsActionBase'
-include 'core:nodejs6Action'
-include 'core:nodejs8Action'
-include 'tests:dat:docker:nodejs6docker'
-include 'tests:dat:docker:nodejs8docker'
+ext.dockerImageName = 'action-nodejs-v10'
+apply from: '../../gradle/docker.gradle'
 
-rootProject.name = 'runtime-nodejs'
+distDocker.dependsOn 'copyProxy'
+distDocker.dependsOn 'copyRunner'
+distDocker.dependsOn 'copyService'
+distDocker.finalizedBy('cleanup')
 
-gradle.ext.openwhisk = [
-        version: '1.0.0-SNAPSHOT'
-]
+task copyProxy(type: Copy) {
+    from '../nodejsActionBase/app.js'
+    into '.'
+}
 
-gradle.ext.scala = [
-    version: '2.12.7',
-    compileFlags: ['-feature', '-unchecked', '-deprecation', '-Xfatal-warnings', '-Ywarn-unused-import']
-]
+task copyRunner(type: Copy) {
+    from '../nodejsActionBase/runner.js'
+    into '.'
+}
 
-gradle.ext.scalafmt = [
-    version: '1.5.0',
-    config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
+task copyService(type: Copy) {
+    from '../nodejsActionBase/src/service.js'
+    into './src'
+}
+
+task cleanup(type: Delete) {
+    delete 'app.js'
+    delete 'runner.js'
+    delete 'src'
+}
diff --git a/core/nodejs10Action/package.json b/core/nodejs10Action/package.json
new file mode 100644
index 0000000..a28200a
--- /dev/null
+++ b/core/nodejs10Action/package.json
@@ -0,0 +1,16 @@
+{
+  "name": "action-nodejs-v8",
+  "version": "1.0.0",
+  "description": "Apache OpenWhisk NodeJS Runtime",
+  "repository": {
+    "type": "git",
+    "url": "git@github.com:apache/incubator-openwhisk-runtime-nodejs.git"
+  },
+  "license": "Apache-2.0",
+  "dependencies": {
+    "openwhisk": "3.18.0",
+    "body-parser": "1.18.3",
+    "express": "4.16.4",
+    "serialize-error": "3.0.0"
+  }
+}
diff --git a/settings.gradle b/settings.gradle
index 9f55aa6..20728ed 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -20,8 +20,10 @@ include 'tests'
 include 'core:nodejsActionBase'
 include 'core:nodejs6Action'
 include 'core:nodejs8Action'
+include 'core:nodejs10Action'
 include 'tests:dat:docker:nodejs6docker'
 include 'tests:dat:docker:nodejs8docker'
+include 'tests:dat:docker:nodejs10docker'
 
 rootProject.name = 'runtime-nodejs'
 
diff --git a/tests/dat/docker/nodejs10docker/Dockerfile b/tests/dat/docker/nodejs10docker/Dockerfile
new file mode 100644
index 0000000..cab4dbe
--- /dev/null
+++ b/tests/dat/docker/nodejs10docker/Dockerfile
@@ -0,0 +1,3 @@
+FROM action-nodejs-v10
+COPY package.json .
+RUN npm install --production
\ No newline at end of file
diff --git a/tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala b/tests/dat/docker/nodejs10docker/build.gradle
similarity index 71%
copy from tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala
copy to tests/dat/docker/nodejs10docker/build.gradle
index 27dfbfb..5f6f094 100644
--- a/tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala
+++ b/tests/dat/docker/nodejs10docker/build.gradle
@@ -15,13 +15,5 @@
  * limitations under the License.
  */
 
-package runtime.actionContainers
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-@RunWith(classOf[JUnitRunner])
-class Nodejs6ConcurrentTests extends NodeJsConcurrentTests {
-  override lazy val nodejsContainerImageName = "nodejs6action"
-  override lazy val nodejsTestDockerImageName = "nodejs6docker"
-}
+ext.dockerImageName = 'nodejs10docker'
+apply from: '../../../../gradle/docker.gradle'
diff --git a/tests/dat/docker/nodejs10docker/package.json b/tests/dat/docker/nodejs10docker/package.json
new file mode 100644
index 0000000..ebfb5a4
--- /dev/null
+++ b/tests/dat/docker/nodejs10docker/package.json
@@ -0,0 +1,8 @@
+{
+  "name": "testdocker",
+  "version": "1.0.0",
+  "main": "index.js",
+  "dependencies": {
+    "openwhisk": "2.0.0"
+  }
+}
\ No newline at end of file
diff --git a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala b/tests/src/test/scala/runtime/actionContainers/NodeJs10ActionContainerTests.scala
similarity index 82%
copy from tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
copy to tests/src/test/scala/runtime/actionContainers/NodeJs10ActionContainerTests.scala
index 565d20e..d721965 100644
--- a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs10ActionContainerTests.scala
@@ -21,7 +21,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
 @RunWith(classOf[JUnitRunner])
-class Nodejs8ConcurrentTests extends NodeJsConcurrentTests {
-  override lazy val nodejsContainerImageName = "action-nodejs-v8"
-  override lazy val nodejsTestDockerImageName = "nodejs8docker"
+class NodeJs10ActionContainerTests extends NodeJs8ActionContainerTests {
+  override lazy val nodejsContainerImageName = "action-nodejs-v10"
+  override lazy val nodejsTestDockerImageName = "nodejs10docker"
 }
diff --git a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala b/tests/src/test/scala/runtime/actionContainers/NodeJs10ConcurrentTests.scala
similarity index 88%
copy from tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
copy to tests/src/test/scala/runtime/actionContainers/NodeJs10ConcurrentTests.scala
index 565d20e..bb59241 100644
--- a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs10ConcurrentTests.scala
@@ -21,7 +21,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
 @RunWith(classOf[JUnitRunner])
-class Nodejs8ConcurrentTests extends NodeJsConcurrentTests {
-  override lazy val nodejsContainerImageName = "action-nodejs-v8"
+class NodeJs10ConcurrentTests extends NodeJsConcurrentTests {
+  override lazy val nodejsContainerImageName = "action-nodejs-v10"
   override lazy val nodejsTestDockerImageName = "nodejs8docker"
 }
diff --git a/tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala b/tests/src/test/scala/runtime/actionContainers/NodeJs6ConcurrentTests.scala
similarity index 94%
rename from tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala
rename to tests/src/test/scala/runtime/actionContainers/NodeJs6ConcurrentTests.scala
index 27dfbfb..e4c7252 100644
--- a/tests/src/test/scala/runtime/actionContainers/Nodejs6ConcurrentTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs6ConcurrentTests.scala
@@ -21,7 +21,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
 @RunWith(classOf[JUnitRunner])
-class Nodejs6ConcurrentTests extends NodeJsConcurrentTests {
+class NodeJs6ConcurrentTests extends NodeJsConcurrentTests {
   override lazy val nodejsContainerImageName = "nodejs6action"
   override lazy val nodejsTestDockerImageName = "nodejs6docker"
 }
diff --git a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala b/tests/src/test/scala/runtime/actionContainers/NodeJs8ConcurrentTests.scala
similarity index 94%
rename from tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
rename to tests/src/test/scala/runtime/actionContainers/NodeJs8ConcurrentTests.scala
index 565d20e..7769d20 100644
--- a/tests/src/test/scala/runtime/actionContainers/Nodejs8ConcurrentTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs8ConcurrentTests.scala
@@ -21,7 +21,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
 @RunWith(classOf[JUnitRunner])
-class Nodejs8ConcurrentTests extends NodeJsConcurrentTests {
+class NodeJs8ConcurrentTests extends NodeJsConcurrentTests {
   override lazy val nodejsContainerImageName = "action-nodejs-v8"
   override lazy val nodejsTestDockerImageName = "nodejs8docker"
 }
diff --git a/tools/travis/publish.sh b/tools/travis/publish.sh
index 74acdb2..4b53bb5 100755
--- a/tools/travis/publish.sh
+++ b/tools/travis/publish.sh
@@ -34,6 +34,8 @@ if [ ${RUNTIME_VERSION} == "6" ]; then
   RUNTIME="nodejs6Action"
 elif [ ${RUNTIME_VERSION} == "8" ]; then
   RUNTIME="nodejs8Action"
+elif [ ${RUNTIME_VERSION} == "10" ]; then
+  RUNTIME="nodejs10Action"
 fi
 
 if [[ ! -z ${DOCKER_USER} ]] && [[ ! -z ${DOCKER_PASSWORD} ]]; then


Mime
View raw message