Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 3175e93

Browse files
authored
initial commit for nodejs20 runtime (#267)
1 parent a498a4b commit 3175e93

25 files changed

+510
-66
lines changed

.github/workflows/run-tests.yml

Lines changed: 9 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
branches: [ "master" ]
1010
pull_request:
1111
branches: [ "master" ]
12+
schedule:
13+
- cron: "0 8 * * 1" # At 08:00 AM, only on Monday
1214

1315
workflow_dispatch:
1416

@@ -22,21 +24,6 @@ jobs:
2224
# Checkout just this repo
2325
- name: Checkout runtime repo
2426
uses: actions/checkout@v3
25-
# with:
26-
# path: runtime
27-
28-
# # run scanCode
29-
# - name: Scan Code
30-
# uses: apache/openwhisk-utilities/scancode@master
31-
32-
# # Install core OpenWhisk artifacts needed to build/test anything else
33-
# - name: Checkout OpenWhisk core repo
34-
# uses: actions/checkout@v3
35-
# with:
36-
# repository: ibm-functions/openwhisk
37-
# ref: master/7ae02b8ede4f4b4068b3b95dbc3f02f902d936c9
38-
# path: core
39-
# fetch-depth: 0
4027

4128
# Setup Python to run the Scala Tests
4229
- name: Setup Python
@@ -51,39 +38,6 @@ jobs:
5138
distribution: 'temurin'
5239
java-version: '11'
5340

54-
55-
# # Setup OpenWhisk
56-
# - name: Setup OpenWhisk
57-
# working-directory: core
58-
# run: |
59-
# ./tools/travis/setup.sh
60-
61-
62-
63-
# - name: Compile and Install Core OpenWhisk
64-
# working-directory: core
65-
# run: |
66-
# export OPENWHISK_HOME=$(pwd)/../core
67-
# IMAGE_PREFIX="testing"
68-
# docker pull ibmfunctions/controller:nightly
69-
# docker tag ibmfunctions/controller:nightly ${IMAGE_PREFIX}/controller
70-
# docker pull ibmfunctions/invoker:nightly
71-
# docker tag ibmfunctions/invoker:nightly ${IMAGE_PREFIX}/invoker
72-
# ./gradlew install
73-
74-
# # Build Runtime:
75-
# - name: Build Runtime
76-
# working-directory: runtime
77-
# run: |
78-
# IMAGE_PREFIX="testing"
79-
# ./gradlew distDocker -PdockerImagePrefix=${IMAGE_PREFIX}
80-
81-
# - name: Deploy
82-
# working-directory: core
83-
# run: |
84-
# export OPENWHISK_HOME=$(pwd)/../core
85-
86-
8741
- name: befor install -> install python3-pip
8842
run: sudo apt-get install -y python3-pip
8943

@@ -101,6 +55,11 @@ jobs:
10155
pip3 --version
10256
pip3.10 --version
10357
58+
- name: Docker Cleanup
59+
run: |
60+
docker image ls
61+
docker image rm $(docker image ls -q) -f
62+
10463
- name: befor install -> setup.sh
10564
run: |
10665
./tools/travis/setup.sh
@@ -113,16 +72,7 @@ jobs:
11372
run: |
11473
pip install --user jinja2==3.0.3
11574
./tools/travis/deploy.sh
116-
75+
11776
- name: script-> test
11877
run: |
119-
./tools/travis/test.sh
120-
121-
122-
123-
124-
# - name: befor install
125-
# run: sudo update-ca-certificates --fresh && ./tools/travis/setup.sh
126-
127-
# - name: script
128-
# run: ./tools/travis/build.sh && ./tools/travis/deploy.sh && ./tools/travis/test.sh
78+
./tools/travis/test.sh

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status](https://travis-ci.org/ibm-functions/runtime-nodejs.svg?branch=master)](https://travis-ci.com/ibm-functions/runtime-nodejs)
44

55
- The runtime provides [nodejs v16](nodejs16/) with a set of [npm packages](nodejs16/package.json) see [nodejs16/CHANGELOG.md](nodejs16/CHANGELOG.md)
6+
- The runtime provides [nodejs v20](nodejs20/) with a set of [npm packages](nodejs20/package.json) see [nodejs20/CHANGELOG.md](nodejs20/CHANGELOG.md)
67

78

89
The runtime provides the following npm packages for [IBM Cloud](https://bluemix.net):

ansible/environments/local/group_vars/all

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ runtimes_manifest:
3636
image:
3737
name: "action-nodejs-v16"
3838
deprecated: false
39+
- kind: "nodejs:20"
40+
default: false
41+
image:
42+
name: "action-nodejs-v20"
43+
deprecated: false
3944
swift:
4045
- kind: "swift:4.2"
4146
default: true

nodejs20/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
package-lock.json
3+
Dockerfile
4+
build.gradle

nodejs20/CHANGELOG.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# IBM Functions NodeJS 16 Runtime Container
2+
3+
## Migrating from `nodejs:16` to `nodejs:20`
4+
Some of the packages have been updated to the latest version and might contain breaking changes please check that the packages you use are still working as expected all supported packages are refrenced in the [package.json](nodejs20/package.json).
5+
6+
- The `@ibm-cloud/cloudant` package has been updated from 0.3.x to 0.5.x and contains breaking changes check the Repository for changes [cloudant-node-sdk](https://github.com/IBM/cloudant-node-sdk)
7+
8+
# 1.0.0
9+
10+
NodeJS version:
11+
- [20.19.0](https://nodejs.org/en/blog/release/v20.19.0/)
12+
13+
NPM version:
14+
- [9.8.0](https://github.com/npm/cli/releases/tag/v9.8.0)
15+
16+
NPM Packages:
17+
- [@ibm-cloud/cloudant v0.5.55](https://www.npmjs.com/package/@ibm-cloud/cloudant) - This is the official Cloudant library for Node.js.
18+
- [@ibm-functions/iam-token-manager v1.0.11](https://www.npmjs.com/package/@ibm-functions/iam-token-manager) - This is an IAM access token manager library for Node.js.
19+
- [@sendgrid/mail v7.7.0](https://www.npmjs.com/package/@sendgrid/mail) - Provides email support via the SendGrid API.
20+
- [@wiotp/sdk v0.7.8](https://www.npmjs.com/package/@wiotp/sdk) - IBM Watson IoT Platform Javascript SDK.
21+
- [amqplib v0.10.3](https://www.npmjs.com/package/amqplib) - A library for making AMQP 0-9-1 clients for Node.JS.
22+
- [apn v2.2.0](https://www.npmjs.com/package/apn) - A Node.js module for interfacing with the Apple Push Notification service.
23+
- [async v3.2.4](https://www.npmjs.com/package/async) - Provides functions for working with asynchronous functions.
24+
- [axios v1.4.0](https://www.npmjs.com/package/axios) - Promise based HTTP client for the browser and node.js.
25+
- [bent v7.3.12](https://www.npmjs.com/package/bent) - Functional HTTP client for Node.js w/ async/await.
26+
- [bodyparser v1.20.2](https://www.npmjs.com/package/body-parser) - Parse incoming request bodies in a middleware before your handlers, available under the req.body property.
27+
- [btoa v1.2.1](https://www.npmjs.com/package/btoa) - A port of the browser's btoa function.
28+
- [bufferutil 4.0.7](https://www.npmjs.com/package/bufferutil) - bufferutil is what makes ws fast.
29+
- [canvas v2.11.2](https://www.npmjs.com/package/canvas) - A Cairo-backed Canvas implementation for Node.js.
30+
- [cassandra-driver v4.6.4](https://www.npmjs.com/package/cassandra-driver) - DataStax Node.js Driver for Apache Cassandra.
31+
- [commander v11.0.0](https://www.npmjs.com/package/commander) - The complete solution for node.js command-line interfaces.
32+
- [composeaddresstranslator v1.0.4](https://www.npmjs.com/package/composeaddresstranslator) - Address translator from Compose UI or API for Scylla databases.
33+
- [consul v1.2.0](https://www.npmjs.com/package/consul) - A client for Consul, involving service discovery and configuration.
34+
- [cookie-parser v1.4.6](https://www.npmjs.com/package/cookie-parser) - Parse Cookie header and populate req.cookies with an object keyed by the cookie names.
35+
- [core-js v3.21.1](https://www.npmjs.com/package/core-js) - Modular standard library for JavaScript.
36+
- [@elastic/elasticsearch v8.8.1](https://www.npmjs.com/package/@elastic/elasticsearch) - The official low-level Elasticsearch client for Node.js.
37+
- [errorhandler v1.5.1](https://www.npmjs.com/package/errorhandler) - Development-only error handler middleware.
38+
- [etcd3 v1.1.0](https://www.npmjs.com/package/etcd3) - A high-quality, production-ready client for the Protocol Buffer-based etcdv3 API.
39+
- [express v4.17.3](https://www.npmjs.com/package/express) - A Fast, unopinionated, minimalist web framework for node.
40+
- [express-session v1.17.3](https://www.npmjs.com/package/express-session) - A server side session data storing module.
41+
- [formidable v3.5.0](https://www.npmjs.com/package/formidable) - A Node.js module for parsing form data, especially file uploads.
42+
- [glob v10.3.3](https://www.npmjs.com/package/glob) - Match files using the patterns the shell uses, like stars and stuff.
43+
- [gm v1.25.0](https://www.npmjs.com/package/gm) - GraphicsMagick and ImageMagick for Node.
44+
- [got v13.0.0](https://www.npmjs.com/package/got) - Human-friendly and powerful HTTP request library for Node.js.
45+
- [ibm-cos-sdk v1.13.1](https://www.npmjs.com/package/ibm-cos-sdk) - {{site.data.keyword.cos_full}} SDK for Node.js
46+
- [ibm_db v3.2.1](https://www.npmjs.com/package/ibm_db) - An asynchronous/synchronous interface for node.js to IBM DB2 and IBM Informix.
47+
- [ibm-watson v8.0.0](https://www.npmjs.com/package/ibm-watson) - A node.js client library to use the Watson APIs.
48+
- [iconv-lite v0.6.3](https://www.npmjs.com/package/iconv-lite) - Pure JS character encoding conversion.
49+
- [jest v29.6.1](https://www.npmjs.com/package/jest) - Delightful JavaScript Testing.
50+
- [jsdom v22.1.0](https://www.npmjs.com/package/jsdom) - jsdom is a pure-JavaScript implementation of many web standards, notably the WHATWG DOM and HTML Standards.
51+
- [jsforce v1.11.1](https://www.npmjs.com/package/jsforce)Salesforce API Library for JavaScript applications.
52+
- [jsonwebtoken v9.0.1](https://www.npmjs.com/package/jsonwebtoken) - An implementation of JSON Web Tokens.
53+
- [lodash v4.17.21](https://www.npmjs.com/package/lodash) - The Lodash library exported as Node.js modules.
54+
- [log4js v6.9.1](https://www.npmjs.com/package/log4js) - This is a conversion of the log4js framework to work with node.
55+
- [marked v5.1.1](https://www.npmjs.com/package/marked) - A full-featured markdown parser and compiler, written in JavaScript. Built for speed.
56+
- [merge v2.1.1](https://www.npmjs.com/package/merge) - Merge multiple objects into one, optionally creating a new cloned object.
57+
- [moment v2.29.1](https://www.npmjs.com/package/moment) - A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
58+
- [mongodb v5.7.0](https://www.npmjs.com/package/mongodb) - The official MongoDB driver for Node.js.
59+
- [mustache v4.2.0](https://www.npmjs.com/package/mustache) - mustache.js is an implementation of the mustache template system in JavaScript.
60+
- [mysql v2.18.1](https://www.npmjs.com/package/mysql) - This is a node.js driver for mysql.
61+
- [nano v10.1.2](https://www.npmjs.com/package/nano) - minimalistic couchdb driver for Node.js.
62+
- [needle v3.2.0](https://www.npmjs.com/package/needle) - The leanest and most handsome HTTP client in the Nodelands.
63+
- [nodemailer v6.9.4](https://www.npmjs.com/package/nodemailer) - Send e-mails from Node.js – easy as cake!
64+
- [oauth2-server v3.1.1](https://www.npmjs.com/package/oauth2-server) - Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with express in Node.js.
65+
- [openwhisk v3.21.7](https://www.npmjs.com/package/openwhisk) - JavaScript client library for the OpenWhisk platform. Provides a wrapper around the OpenWhisk APIs.
66+
- [path-to-regex v6.2.1](https://www.npmjs.com/package/path-to-regexp) - Turn a path string such as /user/:name into a regular expression which can then be used to match against URL paths.
67+
- [pg v8.11.1](https://www.npmjs.com/package/pg) - Non-blocking PostgreSQL client for node.js. Pure JavaScript and optional native libpq bindings.
68+
- [process v0.11.10](https://www.npmjs.com/package/process) - require('process'); just like any other module.
69+
- [pug v3.0.2](https://www.npmjs.com/package/pug) - Implements the Pug templating language.
70+
- [redis v4.0.4](https://www.npmjs.com/package/redis) - This is a complete and feature rich Redis client for Node.js.
71+
- [rimraf v5.0.1](https://www.npmjs.com/package/rimraf) - The UNIX command rm -rf for node.
72+
- [semver v7.5.4](https://www.npmjs.com/package/semver) - Semantic Versioning for Nodejs
73+
- [serialize-error v9.1.0](https://www.npmjs.com/package/serialize-error) - Serialize an error into a plain object.
74+
- [serve-favicon v2.5.0](https://www.npmjs.com/package/serve-favicon) - Node.js middleware for serving a favicon.
75+
- [socket.io v4.7.1](https://www.npmjs.com/package/socket.io) - Socket.IO enables real-time bidirectional event-based communication.
76+
- [socket.io-client v4.7.1](https://www.npmjs.com/package/socket.io-client) - Realtime application framework for socket.io.
77+
- [superagent v8.0.9](https://www.npmjs.com/package/superagent) - SuperAgent is a small progressive client-side HTTP request library, and Node.js module with the same API, sporting many high-level HTTP client features.
78+
- [swagger-tools v0.10.4](https://www.npmjs.com/package/swagger-tools) - Package that provides various tools for integrating and interacting with Swagger.
79+
- [tmp v0.2.1](https://www.npmjs.com/package/tmp) - A simple temporary file and directory creator for node.js.
80+
- [ts-jest v29.1.1](https://www.npmjs.com/package/ts-jest) - A TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript.
81+
- [twilio v4.13.0](https://www.npmjs.com/package/twilio) - A wrapper for the Twilio API, related to voice, video, and messaging.
82+
- [underscore v1.13.6](https://www.npmjs.com/package/underscore) - Underscore.js is a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...) without extending any core JavaScript objects.
83+
- [url-pattern v1.0.3](https://www.npmjs.com/package/url-pattern) - Parse URLs for path parameters more easily than from using a regex string matcher.
84+
- [utf-8-validate v6.0.3](https://www.npmjs.com/package/utf-8-validate) - Check if a buffer contains valid UTF-8 encoded text.
85+
- [uuid v8.3.2](https://www.npmjs.com/package/uuid) - Simple, fast generation of RFC4122 UUIDS.
86+
- [validator v13.9.0](https://www.npmjs.com/package/validator) - A library of string validators and sanitizers.
87+
- [vcap_services v0.7.1](https://www.npmjs.com/package/vcap_services)Parse and return service credentials from VCAP_SERVICES environment variable that IBM Cloud provides.
88+
- [when v3.7.8](https://www.npmjs.com/package/when) - When.js is a rock solid, battle-tested Promises/A+ and when() implementation, including a complete ES6 Promise shim.
89+
- [winston v3.10.0](https://www.npmjs.com/package/winston) - A multi-transport async logging library for node.js. "CHILL WINSTON! ... I put it in the logs."
90+
- [ws v8.13.0](https://www.npmjs.com/package/ws) - ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation.
91+
- [xlsx v0.18.5](https://www.npmjs.com/package/xlsx) - Parser and writer for various spreadsheet formats.
92+
- [xml2js v0.6.0](https://www.npmjs.com/package/xml2js) - Simple XML to JavaScript object converter. It supports bi-directional conversion.
93+
- [xmlhttprequest v1.8.0](https://www.npmjs.com/package/xmlhttprequest) - node-XMLHttpRequest is a wrapper for the built-in http client to emulate the browser XMLHttpRequest object.
94+
- [yauzl v2.10.0](https://www.npmjs.com/package/yauzl) - yet another unzip library for node. For zipping.
95+
- [yazl v2.5.1](https://www.npmjs.com/package/yauzl) - yet another unzip library for node. For zipping.

nodejs20/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
FROM openwhisk/action-nodejs-v20:28ac4c0
3+
4+
COPY ./package.json /
5+
6+
#ENV NODE_ENV=production
7+
ARG NODE_ENV=production
8+
9+
RUN apt-get update \
10+
# Upgrade installed packages to get latest security fixes if the base image does not contain them already.
11+
&& apt-get upgrade -y --no-install-recommends \
12+
# Cleanup apt data, we do not need them later on.
13+
&& rm -rf /var/lib/apt/lists/* \
14+
# We do not have mysql-server installed but mysql-common contains config files (/etc/mysql/my.cnf) for it.
15+
# We need to add some dummy entries to /etc/mysql/my.cnf to sattisfy vulnerability checking of it.
16+
&& echo "\n[mysqld]\nssl-ca=/tmp/ca.pem\nssl-cert=/tmp/server-cert.pem\nssl-key=/tmp/server-key.pem\n" >> /etc/mysql/my.cnf \
17+
# Start adding/updating npm packages.
18+
&& cd / \
19+
&& npm install --omit=dev \
20+
# Check if the base runtime packages required by /nodejsAction/package.json are still available.
21+
# In case this step fails, the package versions required by the /nodejsAction/package.json
22+
# do not match the versions in /package.json. The /package.json versions need to contain the same
23+
# versions as in /nodejsAction/package.json, otherwise the runtime can fail. Adjust the values in
24+
# /packages.json to the values in /nodejsAction/package.json.
25+
# To do the check, we try to install /nodejsAction/package.json with the --dry-run option (only check
26+
# what would happen, no real install). When the install tries to GET (install) packages, we know,
27+
# something is missing and that should not be the case!
28+
&& sed -i 's/devDependencies/ignoredDevDependencies/' /nodejsAction/package.json \
29+
&& echo "\nCheck if the packages required by the parent image provided '/nodejsAction/package.json' are installed...\n" \
30+
&& npm install ./nodejsAction/ --dry-run -verbose 2>&1 | ( ! grep "npm http fetch GET") \
31+
&& echo "Done, the packages required by '/nodejsAction/package.json' are installed.\n" \
32+
# Do some cleanup of not used npm install artifacts.
33+
&& npm cache clean --force \
34+
&& rm -rf /root/.cache/node-gyp \
35+
# Replace default openwhisk main with an iam enabled version.
36+
&& sed -i.bak 's/lib\/main.js/lib\/iam-openwhisk-main.js/' /node_modules/openwhisk/package.json \
37+
# Show current nodejs version.
38+
&& echo "node version: $(node --version)" \
39+
# Show current npm version.
40+
&& echo "npm version: $(npm --version)" \
41+
# Show full list of installed modules.
42+
&& echo "npm list:" && echo "$(cd / && npm list)"
43+
44+
ENV OW_ENABLE_INIT_INSTALL=false
45+
46+
COPY iam-client/iam-openwhisk-main.js /node_modules/openwhisk/lib/

nodejs20/build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ext.dockerImageName = 'action-nodejs-v20'
2+
apply from: '../gradle/docker.gradle'
3+
4+
distDocker.dependsOn 'copyIAMClient'
5+
distDocker.finalizedBy('cleanup')
6+
7+
// To always get the latest vulnerability updates into the image, use --no-cache for building the image.
8+
// This is not needed for travis builds (the VM is always new), but for local development.
9+
dockerBuildArg = ['build','--no-cache']
10+
11+
task copyIAMClient(type: Copy) {
12+
from '../iam-client'
13+
into 'iam-client'
14+
}
15+
16+
task cleanup(type: Delete) {
17+
delete 'iam-client'
18+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy