diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index 786cb92a..f76de478 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "18", "18-minimal", "20", "20-minimal", "22", "22-minimal" ] + version: [ "20", "20-minimal", "22", "22-minimal" ] os_test: [ "fedora", "rhel8", "rhel9", "rhel10", "c9s", "c10s" ] test_case: [ "container" ] diff --git a/.github/workflows/container-upstream-tests.yml b/.github/workflows/container-upstream-tests.yml index d278eba5..efb3081f 100644 --- a/.github/workflows/container-upstream-tests.yml +++ b/.github/workflows/container-upstream-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "18", "18-minimal", "20", "20-minimal", "22", "22-minimal" ] + version: [ "20", "20-minimal", "22", "22-minimal" ] os_test: [ "fedora", "rhel8", "rhel9", "rhel10", "c9s", "c10s" ] test_case: [ "container-upstream" ] diff --git a/.github/workflows/openshift-pytests.yml b/.github/workflows/openshift-pytests.yml index 84d2f466..866ac27d 100644 --- a/.github/workflows/openshift-pytests.yml +++ b/.github/workflows/openshift-pytests.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "16", "16-minimal", "18", "18-minimal", "20", "20-minimal", "22", "22-minimal" ] + version: [ "20", "20-minimal", "22", "22-minimal" ] os_test: [ "rhel8", "rhel9", "rhel10" ] test_case: [ "openshift-pytest" ] diff --git a/.github/workflows/openshift-tests.yml b/.github/workflows/openshift-tests.yml index 58701132..e76c7e57 100644 --- a/.github/workflows/openshift-tests.yml +++ b/.github/workflows/openshift-tests.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "18", "18-minimal", "20", "20-minimal", "22", "22-minimal" ] + version: [ "20", "20-minimal", "22", "22-minimal" ] os_test: [ "rhel8", "rhel9", "rhel10" ] test_case: [ "openshift-4" ] diff --git a/18-minimal/README.md b/18-minimal/README.md index c5e605fb..28f2ac21 100644 --- a/18-minimal/README.md +++ b/18-minimal/README.md @@ -1,373 +1,4 @@ NodeJS 18 minimal container image ========================= -This container image includes Node.JS 18 on top of a minimal base image for your Node.JS 18 applications. This image is designed to be used -with the full-sized s2i-enabled Node.JS 18 image to build the application. The image can be used as a standalone s2i-enabled image as well, -but compared to the full-sized Node.JS 18 image it will be missing many build-time dependencies. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 18 available as a minimal container is a base platform for -running various Node.js 18 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-18` image, available via `nodejs:18-ubi8` imagestream tag in Openshift -to build the application, as well as the `ubi8/nodejs-18-minimal` image, available via `nodejs:18-ubi8-minimal` image stream -for running the resulting application. - -With these two images we can create a [chained build](https://docs.openshift.com/container-platform/4.7/cicd/builds/advanced-build-operations.html#builds-chaining-builds_advanced-build-operations) in Openshift using two BuildConfigs: - -The first BuildConfig defines and builds the builder image, using the source-to-image strategy, and pushes the result into -the `nodejs-builder-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-builder-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-builder-image:latest - source: - git: - uri: https://github.com/sclorg/nodejs-ex.git - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: nodejs:18-ubi8 - namespace: openshift -``` - -The second BuildConfig takes the resulting image from the `nodejs-builder-image` imagestream, copies the application source (including build artifacts) -from the image and creates a new runtime image on top of the nodejs minimal image, with the application copied in and prepared to run. -The resulting runtime image is then pushed into the `nodejs-runtime-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-runtime-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-runtime-image:latest - source: - dockerfile: |- - FROM nodejs:18-ubi8-minimal - COPY src $HOME - CMD /usr/libexec/s2i/run - images: - - from: - kind: ImageStreamTag - name: nodejs-builder-image:latest - paths: - - sourcePath: /opt/app-root/src - destinationDir: "." - strategy: - dockerStrategy: - from: - kind: ImageStreamTag - name: nodejs:18-ubi8-minimal - triggers: - - imageChange: {} - type: ImageChange -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, only the `run` script is included in this image. - -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull the base builder and minimal runtime images - -``` -podman pull ubi8/nodejs-18 -podman pull ubi8/nodejs-18-minimal -``` - -The UBI images `ubi8/nodejs-18` and `ubi8/nodejs-18-minimal` that are used in this example are both usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-18 as builder - -# Add application sources -ADD app-src $HOME - -# Install the dependencies -RUN npm install - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-18-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-18 as builder - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-18-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -#### Used in the minimal image - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -#### Additional variables used in the full-sized image - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app - -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -for RHEL8 it's `Dockerfile.rhel8` and the Fedora Dockerfile is called Dockerfile.fedora. +**The NodeJS 18 minimal image is deprecated.** \ No newline at end of file diff --git a/18/README.md b/18/README.md index c0f46047..6e7c9af2 100644 --- a/18/README.md +++ b/18/README.md @@ -1,301 +1,4 @@ NodeJS 18 container image ========================= -This container image includes Node.JS 18 as a [S2I](https://github.com/openshift/source-to-image) base image for your Node.JS 18 applications. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 18 available as container is a base platform for -building and running various Node.js 18 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-18` image, available via `nodejs:18` imagestream tag in Openshift. - -To build a simple [nodejs-sample-app](https://github.com/sclorg/nodejs-ex.git) application in Openshift: - -``` -oc new-app nodejs:18~https://github.com/sclorg/nodejs-ex.git -``` - -To access the application: -``` -$ oc get pods -$ oc exec -- curl 127.0.0.1:8080 -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, important scripts are included in the builder image: - -* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Node.js application development (see the **Environment variables** section below). -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull a base builder image to build on - -``` -podman pull ubi8/nodejs-18 -``` - -An UBI image `ubi8/nodejs-18` is used in this example. This image is usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-18 - -# Add application sources -ADD app-src . - -# Install the dependencies -RUN npm install - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-18 - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app - -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9` and the Fedora Dockerfile is called Dockerfile.fedora. +**The NodeJS 18 image is deprecated.** \ No newline at end of file diff --git a/Makefile b/Makefile index cdaa14e4..9e3c6788 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Include common Makefile code. BASE_IMAGE_NAME = nodejs -VERSIONS = 18 18-minimal 20 20-minimal 22 22-minimal +VERSIONS = 20 20-minimal 22 22-minimal OPENSHIFT_NAMESPACES = # HACK: Ensure that 'git pull' for old clones doesn't cause confusion. diff --git a/README.md b/README.md index 649e29b5..b79dfd66 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ NodeJS container images [![Build and push images to Quay.io registry](https://github.com/sclorg/s2i-nodejs-container/actions/workflows/build-and-push.yml/badge.svg)](https://github.com/sclorg/s2i-nodejs-container/actions/workflows/build-and-push.yml) Images available on Quay are: -* Fedora [nodejs-18](https://quay.io/repository/fedora/nodejs-18) * Fedora [nodejs-20](https://quay.io/repository/fedora/nodejs-20) * Fedora [nodejs-22](https://quay.io/repository/fedora/nodejs-22) @@ -26,8 +25,6 @@ For more information about concepts used in these container images, see the Versions --------------- Node.JS versions currently provided are: -* [NodeJS 18](18) -* [NodeJS 18-minimal](18-minimal) * [NodeJS 20](20) * [NodeJS 20-minimal](20-minimal) * [NodeJS 22](22) @@ -52,7 +49,7 @@ To build a Node.JS image, choose either the CentOS or RHEL based image: To download it run: ``` - $ podman pull registry.access.redhat.com/rhel8/nodejs-18 + $ podman pull registry.access.redhat.com/rhel8/nodejs-20 ``` To build a RHEL based Node.JS image, you need to run the build on a properly @@ -62,7 +59,7 @@ To build a Node.JS image, choose either the CentOS or RHEL based image: $ git clone --recursive https://github.com/sclorg/s2i-nodejs-container.git $ cd s2i-nodejs-container $ git submodule update --init - $ make build TARGET=rhel8 VERSIONS=18 + $ make build TARGET=rhel8 VERSIONS=20 ``` * **CentOS Stream based image** @@ -91,12 +88,6 @@ on all provided versions of Node.JS.** Usage ----- -For information about usage of Dockerfile for NodeJS 18, -see [usage documentation](18/README.md). - -For information about usage of Dockerfile for NodeJS 18 minimal, -see [usage documentation](18-minimal/README.md). - For information about usage of Dockerfile for NodeJS 20, see [usage documentation](20/README.md). diff --git a/imagestreams/imagestreams.yaml b/imagestreams/imagestreams.yaml index 80a2e1fd..a18cb7cd 100644 --- a/imagestreams/imagestreams.yaml +++ b/imagestreams/imagestreams.yaml @@ -12,20 +12,14 @@ latest: "22-ubi9" distros: - name: UBI 8 - app_versions: ["18", "18-minimal", "20", "20-minimal"] + app_versions: ["20", "20-minimal"] - name: UBI 9 - app_versions: ["18", "18-minimal", "20", "20-minimal", "22", "22-minimal"] + app_versions: ["20", "20-minimal", "22", "22-minimal"] custom_tags: - - name: "18-ubi8-minimal" - distro: UBI 8 - app_version: "18-minimal" - name: "20-ubi8-minimal" distro: UBI 8 app_version: "20-minimal" - - name: "18-ubi9-minimal" - distro: UBI 9 - app_version: "18-minimal" - name: "20-ubi9-minimal" distro: UBI 9 app_version: "20-minimal" @@ -37,21 +31,15 @@ latest: "22-ubi9" distros: - name: UBI 8 - app_versions: ["18", "18-minimal", "20", "20-minimal"] + app_versions: ["20", "20-minimal"] - name: UBI 9 - app_versions: ["18", "18-minimal", "20", "20-minimal", "22", "22-minimal"] + app_versions: ["20", "20-minimal", "22", "22-minimal"] # these are non standard tags, maintained for backwards compatibility custom_tags: - - name: "18-ubi8-minimal" - distro: UBI 8 - app_version: "18-minimal" - name: "20-ubi8-minimal" distro: UBI 8 app_version: "20-minimal" - - name: "18-ubi9-minimal" - distro: UBI 9 - app_version: "18-minimal" - name: "20-ubi9-minimal" distro: UBI 9 app_version: "20-minimal" @@ -63,20 +51,14 @@ latest: "22-ubi9" distros: - name: UBI 8 - app_versions: ["18", "18-minimal", "20", "20-minimal"] + app_versions: ["20", "20-minimal"] - name: UBI 9 - app_versions: ["18", "18-minimal", "20", "20-minimal", "22", "22-minimal"] + app_versions: ["20", "20-minimal", "22", "22-minimal"] custom_tags: - - name: "18-ubi8-minimal" - distro: UBI 8 - app_version: "18-minimal" - name: "20-ubi8-minimal" distro: UBI 8 app_version: "20-minimal" - - name: "18-ubi9-minimal" - distro: UBI 9 - app_version: "18-minimal" - name: "20-ubi9-minimal" distro: UBI 9 app_version: "20-minimal" diff --git a/imagestreams/nodejs-centos.json b/imagestreams/nodejs-centos.json index 9a11ddbb..17437b8b 100644 --- a/imagestreams/nodejs-centos.json +++ b/imagestreams/nodejs-centos.json @@ -9,44 +9,6 @@ }, "spec": { "tags": [ - { - "name": "18-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi8/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8", "annotations": { @@ -85,44 +47,6 @@ "type": "Local" } }, - { - "name": "18-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi9/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9", "annotations": { @@ -199,25 +123,6 @@ "type": "Local" } }, - { - "name": "18-ubi8-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8-minimal", "annotations": { @@ -237,25 +142,6 @@ "type": "Local" } }, - { - "name": "18-ubi9-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.access.redhat.com/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9-minimal", "annotations": { diff --git a/imagestreams/nodejs-rhel-aarch64.json b/imagestreams/nodejs-rhel-aarch64.json index 7dbd3b5c..c4149775 100644 --- a/imagestreams/nodejs-rhel-aarch64.json +++ b/imagestreams/nodejs-rhel-aarch64.json @@ -9,44 +9,6 @@ }, "spec": { "tags": [ - { - "name": "18-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8", "annotations": { @@ -85,44 +47,6 @@ "type": "Local" } }, - { - "name": "18-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9", "annotations": { @@ -199,25 +123,6 @@ "type": "Local" } }, - { - "name": "18-ubi8-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8-minimal", "annotations": { @@ -237,25 +142,6 @@ "type": "Local" } }, - { - "name": "18-ubi9-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9-minimal", "annotations": { diff --git a/imagestreams/nodejs-rhel.json b/imagestreams/nodejs-rhel.json index 7dbd3b5c..c4149775 100644 --- a/imagestreams/nodejs-rhel.json +++ b/imagestreams/nodejs-rhel.json @@ -9,44 +9,6 @@ }, "spec": { "tags": [ - { - "name": "18-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi8", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8", "annotations": { @@ -85,44 +47,6 @@ "type": "Local" } }, - { - "name": "18-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18 (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18 applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, - { - "name": "18-minimal-ubi9", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9", "annotations": { @@ -199,25 +123,6 @@ "type": "Local" } }, - { - "name": "18-ubi8-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 8)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi8/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi8-minimal", "annotations": { @@ -237,25 +142,6 @@ "type": "Local" } }, - { - "name": "18-ubi9-minimal", - "annotations": { - "openshift.io/display-name": "Node.js 18-minimal (UBI 9)", - "openshift.io/provider-display-name": "Red Hat, Inc.", - "description": "Build and run Node.js 18-minimal applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/s2i-nodejs-container/blob/master/18-minimal/README.md.", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "version": "18-minimal", - "sampleRepo": "https://github.com/sclorg/nodejs-ex.git" - }, - "from": { - "kind": "DockerImage", - "name": "registry.redhat.io/ubi9/nodejs-18-minimal:latest" - }, - "referencePolicy": { - "type": "Local" - } - }, { "name": "20-ubi9-minimal", "annotations": { diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index 3a2b426c..b7fb3345 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -457,12 +457,6 @@ function test_client_fastify() { if [[ "${VERSION}" == *"minimal"* ]]; then VERSION=$(echo "${VERSION}" | cut -d "-" -f 1) fi - if [[ "$VERSION" == "18" ]]; then - if [ "$OS" == "rhel8" ] || [ "$OS" == "rhel9" ] || [ "$OS" == "rhel10" ]; then - echo "Fastify is not supported in $VERSION and rhel8, rhel9, and rhel10" - return - fi - fi echo "Running fastify client test" test_running_client_js fastify } diff --git a/test/test_shared_helm_nodejs_imagestreams.py b/test/test_shared_helm_nodejs_imagestreams.py index 72bf80a4..8bcf0a20 100644 --- a/test/test_shared_helm_nodejs_imagestreams.py +++ b/test/test_shared_helm_nodejs_imagestreams.py @@ -29,21 +29,21 @@ def teardown_method(self): self.hc_api.delete_project() @pytest.mark.parametrize( - "version,registry", + "version,registry,expected", [ - ("22-ubi9", "registry.redhat.io/ubi9/nodejs-22:latest"), - ("22-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-22-minimal:latest"), - ("20-ubi9", "registry.redhat.io/ubi9/nodejs-20:latest"), - ("20-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-20-minimal:latest"), - ("20-ubi8", "registry.redhat.io/ubi8/nodejs-20:latest"), - ("20-ubi8-minimal", "registry.redhat.io/ubi8/nodejs-20-minimal:latest"), - ("18-ubi9", "registry.redhat.io/ubi9/nodejs-18:latest"), - ("18-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-18-minimal:latest"), - ("18-ubi8", "registry.redhat.io/ubi8/nodejs-18:latest"), - ("18-ubi8-minimal", "registry.redhat.io/ubi8/nodejs-18-minimal:latest"), + ("22-ubi9", "registry.redhat.io/ubi9/nodejs-22:latest", True), + ("22-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-22-minimal:latest", True), + ("20-ubi9", "registry.redhat.io/ubi9/nodejs-20:latest", True), + ("20-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-20-minimal:latest", True), + ("20-ubi8", "registry.redhat.io/ubi8/nodejs-20:latest", True), + ("20-ubi8-minimal", "registry.redhat.io/ubi8/nodejs-20-minimal:latest", True), + ("18-ubi9", "registry.redhat.io/ubi9/nodejs-18:latest", False), + ("18-ubi9-minimal", "registry.redhat.io/ubi9/nodejs-18-minimal:latest", False), + ("18-ubi8", "registry.redhat.io/ubi8/nodejs-18:latest", False), + ("18-ubi8-minimal", "registry.redhat.io/ubi8/nodejs-18-minimal:latest", False), ], ) - def test_package_imagestream(self, version, registry): + def test_package_imagestream(self, version, registry, expected): assert self.hc_api.helm_package() assert self.hc_api.helm_installation() - assert self.hc_api.check_imagestreams(version=version, registry=registry) + assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected