You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mh...@apache.org on 2021/12/09 15:42:23 UTC
[openwhisk-runtime-nodejs] branch master updated: Add Nodejs 16 (#210)
This is an automated email from the ASF dual-hosted git repository.
mhenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-nodejs.git
The following commit(s) were added to refs/heads/master by this push:
new 7f7c181 Add Nodejs 16 (#210)
7f7c181 is described below
commit 7f7c1811579d022ecaba1ac87ac01cbfe55e8504
Author: Luke-Roy-IBM <83...@users.noreply.github.com>
AuthorDate: Thu Dec 9 16:39:59 2021 +0100
Add Nodejs 16 (#210)
Adding Nodejs 16.13 runtime
---
.travis.yml | 2 +-
README.md | 12 ++-
core/nodejs16Action/.dockerignore | 13 ++++
core/nodejs16Action/CHANGELOG.md | 28 +++++++
core/nodejs16Action/Dockerfile | 43 +++++++++++
core/nodejs16Action/build.gradle | 86 ++++++++++++++++++++++
settings.gradle | 2 +
tests/dat/docker/nodejs16docker/Dockerfile | 19 +++++
.../dat/docker/nodejs16docker/build.gradle | 32 +-------
tests/dat/docker/nodejs16docker/package.json | 8 ++
.../NodeJs16ActionContainerTests.scala | 36 ++-------
.../actionContainers/NodeJs16ConcurrentTests.scala | 36 ++-------
12 files changed, 229 insertions(+), 88 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index abe9e52..fe452af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,7 +42,7 @@ deploy:
all_branches: true
repo: apache/openwhisk-runtime-nodejs
- provider: script
- script: "./tools/travis/publish.sh openwhisk nodejs12Action nightly && ./tools/travis/publish.sh openwhisk nodejs14Action nightly && ./tools/travis/publish.sh openwhisk typescript37Action nightly"
+ script: "./tools/travis/publish.sh openwhisk nodejs12Action nightly && ./tools/travis/publish.sh openwhisk nodejs14Action nightly && ./tools/travis/publish.sh openwhisk nodejs16Action nightly && ./tools/travis/publish.sh openwhisk typescript37Action nightly"
on:
branch: master
repo: apache/openwhisk-runtime-nodejs
diff --git a/README.md b/README.md
index abccb88..c423b37 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ The following Node.js runtime versions (with kind & image labels) are generated
- Node.js 12.22.2 (`nodejs:12` & `openwhisk/action-nodejs-v12`)
- Node.js 14.17.2 (`nodejs:14` & `openwhisk/action-nodejs-v14`)
+- Node.js 16.13.1 (`nodejs:16` & `openwhisk/action-nodejs-v16`)
This README documents the build, customisation and testing of these runtime images.
@@ -49,12 +50,19 @@ wsk action update myAction myAction.js --kind nodejs:12
wsk action update myAction myAction.js --kind nodejs:14
```
+### Node.js v16
+
+```
+wsk action update myAction myAction.js --kind nodejs:16
+```
+
## Images
All the runtime images are published by the project to Docker Hub @ [https://hub.docker.com/u/openwhisk](https://hub.docker.com/u/openwhisk)
- [https://hub.docker.com/r/openwhisk/action-nodejs-v12](https://hub.docker.com/r/openwhisk/action-nodejs-v12)
- [https://hub.docker.com/r/openwhisk/action-nodejs-v14](https://hub.docker.com/r/openwhisk/action-nodejs-v14)
+- [https://hub.docker.com/r/openwhisk/action-nodejs-v16](https://hub.docker.com/r/openwhisk/action-nodejs-v16)
These images can be used to execute Node.js actions on any deployment of Apache OpenWhisk, even those without those images defined the in runtime manifest, using the `--docker` action parameter.
@@ -83,9 +91,10 @@ The `core/nodejsActionBase` folder contains the Node.js app server used to imple
```
./gradlew core:nodejs12Action:distDocker
./gradlew core:nodejs14Action:distDocker
+./gradlew core:nodejs16Action:distDocker
```
-This will return the following runtime images with the following names: `action-nodejs-v12` and `action-nodejs-v14`.
+This will return the following runtime images with the following names: `action-nodejs-v12`, `action-nodejs-v14` and `action-nodejs-v16`.
### Testing
@@ -103,6 +112,7 @@ This will return the following runtime images with the following names: `action-
```
./gradlew tests:dat:docker:nodejs12docker:distDocker
./gradlew tests:dat:docker:nodejs14docker:distDocker
+./gradlew tests:dat:docker:nodejs16docker:distDocker
```
- Run the project tests.
diff --git a/core/nodejs16Action/.dockerignore b/core/nodejs16Action/.dockerignore
new file mode 100644
index 0000000..a1d03cb
--- /dev/null
+++ b/core/nodejs16Action/.dockerignore
@@ -0,0 +1,13 @@
+*.*~
+*.yaml
+*.tmpl
+*.gradle
+.dockerignore
+.project
+.settings
+build.xml
+Dockerfile
+logs
+node_modules
+package-lock.json
+test.js
diff --git a/core/nodejs16Action/CHANGELOG.md b/core/nodejs16Action/CHANGELOG.md
new file mode 100644
index 0000000..db390ed
--- /dev/null
+++ b/core/nodejs16Action/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 16 OpenWhisk Runtime Container
+
+# Next Release
+
+Changes:
+ - Initial release with support for Node.js v1.16
+
+Node.js version = [16.13.1](https://nodejs.org/en/blog/release/v16.13.1/)
+OpenWhisk version = [OpenWhisk v3.21.2](https://www.npmjs.com/package/openwhisk)
diff --git a/core/nodejs16Action/Dockerfile b/core/nodejs16Action/Dockerfile
new file mode 100644
index 0000000..280de4c
--- /dev/null
+++ b/core/nodejs16Action/Dockerfile
@@ -0,0 +1,43 @@
+#
+# 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:16.13-stretch
+
+# Initial update and some basics.
+#
+RUN apt-get update && apt-get install -y \
+ imagemagick \
+ graphicsmagick \
+ unzip \
+ && rm -rf /var/lib/apt/lists/*
+
+# Add sources and copy the package.json to root container,
+# so npm packages from user functions take precedence.
+#
+WORKDIR /nodejsAction
+ADD . /nodejsAction/
+COPY package.json /
+
+# Customize runtime with additional packages.
+# Install package globally so user packages can override.
+#
+RUN cd / && npm install --no-package-lock --production \
+ && npm cache clean --force
+
+EXPOSE 8080
+
+CMD node --expose-gc app.js
diff --git a/core/nodejs16Action/build.gradle b/core/nodejs16Action/build.gradle
new file mode 100644
index 0000000..ac4c50e
--- /dev/null
+++ b/core/nodejs16Action/build.gradle
@@ -0,0 +1,86 @@
+/*
+ * 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: 'eclipse'
+eclipse {
+ project {
+ natures 'org.eclipse.wst.jsdt.core.jsNature'
+ buildCommand 'org.eclipse.wst.jsdt.core.javascriptValidator'
+ }
+}
+
+ext.dockerImageName = 'action-nodejs-v16'
+apply from: '../../gradle/docker.gradle'
+
+distDocker.dependsOn 'copyPackageJson'
+distDocker.dependsOn 'copyProxy'
+distDocker.dependsOn 'copyRunner'
+distDocker.dependsOn 'copyService'
+distDocker.dependsOn 'copyPlatform'
+distDocker.dependsOn 'copyOpenWhisk'
+distDocker.dependsOn 'copyKnative'
+distDocker.dependsOn 'copyBuildTemplate'
+distDocker.finalizedBy('cleanup')
+
+task copyPackageJson(type: Copy) {
+ from '../nodejsActionBase/package.json'
+ into '.'
+}
+
+task copyProxy(type: Copy) {
+ from '../nodejsActionBase/app.js'
+ into '.'
+}
+
+task copyRunner(type: Copy) {
+ from '../nodejsActionBase/runner.js'
+ into '.'
+}
+
+task copyService(type: Copy) {
+ from '../nodejsActionBase/src/service.js'
+ into './src'
+}
+
+task copyPlatform(type: Copy) {
+ from '../nodejsActionBase/platform/platform.js'
+ into './platform'
+}
+
+task copyOpenWhisk(type: Copy) {
+ from '../nodejsActionBase/platform/openwhisk.js'
+ into './platform'
+}
+
+task copyKnative(type: Copy) {
+ from '../nodejsActionBase/platform/knative.js'
+ into './platform'
+}
+
+task copyBuildTemplate(type: Copy) {
+ from '../nodejsActionBase/buildtemplate.yaml'
+ into '.'
+}
+
+task cleanup(type: Delete) {
+ delete 'package.json'
+ delete 'app.js'
+ delete 'runner.js'
+ delete 'src'
+ delete 'platform'
+ delete 'buildtemplate.yaml'
+}
diff --git a/settings.gradle b/settings.gradle
index 4f51240..cd8be37 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -20,9 +20,11 @@ include 'tests'
include 'core:nodejsActionBase'
include 'core:nodejs12Action'
include 'core:nodejs14Action'
+include 'core:nodejs16Action'
include 'core:typescript37Action'
include 'tests:dat:docker:nodejs12docker'
include 'tests:dat:docker:nodejs14docker'
+include 'tests:dat:docker:nodejs16docker'
include 'tests:dat:docker:typescript37docker'
rootProject.name = 'runtime-nodejs'
diff --git a/tests/dat/docker/nodejs16docker/Dockerfile b/tests/dat/docker/nodejs16docker/Dockerfile
new file mode 100644
index 0000000..b6f3a53
--- /dev/null
+++ b/tests/dat/docker/nodejs16docker/Dockerfile
@@ -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.
+#
+FROM action-nodejs-v16
+COPY package.json .
+RUN npm install --production
diff --git a/settings.gradle b/tests/dat/docker/nodejs16docker/build.gradle
similarity index 51%
copy from settings.gradle
copy to tests/dat/docker/nodejs16docker/build.gradle
index 4f51240..ad74d5c 100644
--- a/settings.gradle
+++ b/tests/dat/docker/nodejs16docker/build.gradle
@@ -15,33 +15,5 @@
* limitations under the License.
*/
-include 'tests'
-
-include 'core:nodejsActionBase'
-include 'core:nodejs12Action'
-include 'core:nodejs14Action'
-include 'core:typescript37Action'
-include 'tests:dat:docker:nodejs12docker'
-include 'tests:dat:docker:nodejs14docker'
-include 'tests:dat:docker:typescript37docker'
-
-rootProject.name = 'runtime-nodejs'
-
-gradle.ext.openwhisk = [
- version: '1.0.0-SNAPSHOT'
-]
-
-gradle.ext.scala = [
- version: '2.12.10',
- depVersion : '2.12',
- compileFlags: ['-feature', '-unchecked', '-deprecation', '-Xfatal-warnings', '-Ywarn-unused-import']
-]
-
-
-gradle.ext.akka = [version : '2.6.12']
-gradle.ext.akka_http = [version : '10.2.4']
-
-gradle.ext.scalafmt = [
- version: '1.5.0',
- config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
+ext.dockerImageName = 'nodejs16docker'
+apply from: '../../../../gradle/docker.gradle'
diff --git a/tests/dat/docker/nodejs16docker/package.json b/tests/dat/docker/nodejs16docker/package.json
new file mode 100644
index 0000000..6822c09
--- /dev/null
+++ b/tests/dat/docker/nodejs16docker/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "testdocker",
+ "version": "1.0.0",
+ "main": "index.js",
+ "dependencies": {
+ "openwhisk": "2.0.0"
+ }
+}
diff --git a/settings.gradle b/tests/src/test/scala/runtime/actionContainers/NodeJs16ActionContainerTests.scala
similarity index 51%
copy from settings.gradle
copy to tests/src/test/scala/runtime/actionContainers/NodeJs16ActionContainerTests.scala
index 4f51240..456be7b 100644
--- a/settings.gradle
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs16ActionContainerTests.scala
@@ -15,33 +15,13 @@
* limitations under the License.
*/
-include 'tests'
+package runtime.actionContainers
-include 'core:nodejsActionBase'
-include 'core:nodejs12Action'
-include 'core:nodejs14Action'
-include 'core:typescript37Action'
-include 'tests:dat:docker:nodejs12docker'
-include 'tests:dat:docker:nodejs14docker'
-include 'tests:dat:docker:typescript37docker'
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
-rootProject.name = 'runtime-nodejs'
-
-gradle.ext.openwhisk = [
- version: '1.0.0-SNAPSHOT'
-]
-
-gradle.ext.scala = [
- version: '2.12.10',
- depVersion : '2.12',
- compileFlags: ['-feature', '-unchecked', '-deprecation', '-Xfatal-warnings', '-Ywarn-unused-import']
-]
-
-
-gradle.ext.akka = [version : '2.6.12']
-gradle.ext.akka_http = [version : '10.2.4']
-
-gradle.ext.scalafmt = [
- version: '1.5.0',
- config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
+@RunWith(classOf[JUnitRunner])
+class NodeJs16ActionContainerTests extends NodeJsActionContainerTests {
+ override lazy val nodejsContainerImageName = "action-nodejs-v16"
+ override lazy val nodejsTestDockerImageName = "nodejs16docker"
+}
diff --git a/settings.gradle b/tests/src/test/scala/runtime/actionContainers/NodeJs16ConcurrentTests.scala
similarity index 51%
copy from settings.gradle
copy to tests/src/test/scala/runtime/actionContainers/NodeJs16ConcurrentTests.scala
index 4f51240..d2c28fb 100644
--- a/settings.gradle
+++ b/tests/src/test/scala/runtime/actionContainers/NodeJs16ConcurrentTests.scala
@@ -15,33 +15,13 @@
* limitations under the License.
*/
-include 'tests'
+package runtime.actionContainers
-include 'core:nodejsActionBase'
-include 'core:nodejs12Action'
-include 'core:nodejs14Action'
-include 'core:typescript37Action'
-include 'tests:dat:docker:nodejs12docker'
-include 'tests:dat:docker:nodejs14docker'
-include 'tests:dat:docker:typescript37docker'
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
-rootProject.name = 'runtime-nodejs'
-
-gradle.ext.openwhisk = [
- version: '1.0.0-SNAPSHOT'
-]
-
-gradle.ext.scala = [
- version: '2.12.10',
- depVersion : '2.12',
- compileFlags: ['-feature', '-unchecked', '-deprecation', '-Xfatal-warnings', '-Ywarn-unused-import']
-]
-
-
-gradle.ext.akka = [version : '2.6.12']
-gradle.ext.akka_http = [version : '10.2.4']
-
-gradle.ext.scalafmt = [
- version: '1.5.0',
- config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
+@RunWith(classOf[JUnitRunner])
+class NodeJs16ConcurrentTests extends NodeJsConcurrentTests {
+ override lazy val nodejsContainerImageName = "action-nodejs-v16"
+ override lazy val nodejsTestDockerImageName = "nodejs16docker"
+}