From bc21c7e2cb0639606bd1a1e736790c22b5ec3701 Mon Sep 17 00:00:00 2001 From: Petr Khartskhaev Date: Mon, 13 Jul 2026 15:56:46 +0200 Subject: [PATCH 1/3] Add dist-gen source files for generated sources --- manifest.yml | 69 ++++++++++ specs/multispec.yml | 157 +++++++++++++++++++++++ src/Dockerfile | 146 +++++++++++++++++++++ src/README.md | 204 ++++++++++++++++++++++++++++++ src/test/__init__.py | 0 src/test/conftest.py | 32 +++++ src/test/run | 91 +++++++++++++ src/test/run-pytest | 18 +++ src/test/test_container_basics.py | 99 +++++++++++++++ 9 files changed, 816 insertions(+) create mode 100644 manifest.yml create mode 100644 specs/multispec.yml create mode 100644 src/Dockerfile create mode 100644 src/README.md create mode 100644 src/test/__init__.py create mode 100644 src/test/conftest.py create mode 100755 src/test/run create mode 100755 src/test/run-pytest create mode 100644 src/test/test_container_basics.py diff --git a/manifest.yml b/manifest.yml new file mode 100644 index 0000000..6e75c76 --- /dev/null +++ b/manifest.yml @@ -0,0 +1,69 @@ +# Manifest for image directories creation +# every dest path will be prefixed by $DESTDIR/$version + +# Files containing distgen directives, which are used for each +# (distro, version) combination not excluded in multispec +DISTGEN_MULTI_RULES: + - src: src/Dockerfile + dest: Dockerfile.f38 + + - src: src/Dockerfile + dest: Dockerfile.f39 + + - src: src/Dockerfile + dest: Dockerfile.f40 + + - src: src/Dockerfile + dest: Dockerfile.f41 + + - src: src/Dockerfile + dest: Dockerfile.f42 + + - src: src/Dockerfile + dest: Dockerfile.f43 + + - src: src/Dockerfile + dest: Dockerfile.f44 + + - src: src/Dockerfile + dest: Dockerfile.rhel8 + + - src: src/Dockerfile + dest: Dockerfile.rhel9 + + - src: src/Dockerfile + dest: Dockerfile.rhel10 + + - src: src/Dockerfile + dest: Dockerfile.c9s + + - src: src/Dockerfile + dest: Dockerfile.c10s + +DISTGEN_RULES: + - src: src/test/__init__.py + dest: test/__init__.py + + - src: src/test/run + dest: test/run + mode: "0755" + + - src: src/test/run-pytest + dest: test/run-pytest + mode: "0755" + + - src: src/test/conftest.py + dest: test/conftest.py + + - src: src/test/test_container_basics.py + dest: test/test_container_basics.py + + - src: src/README.md + dest: README.md + +SYMLINK_RULES: + - src: ../common/shared-scripts/core + dest: root + + - src: Dockerfile.f44 + dest: Dockerfile.fedora diff --git a/specs/multispec.yml b/specs/multispec.yml new file mode 100644 index 0000000..7672ef6 --- /dev/null +++ b/specs/multispec.yml @@ -0,0 +1,157 @@ +version: 1 + +specs: + distroinfo: + fedora38: + number: "38" + distros: + - fedora-38-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 18 + fedora39: + number: "39" + distros: + - fedora-39-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 20 + fedora40: + number: "40" + distros: + - fedora-40-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 20 + fedora41: + number: "41" + distros: + - fedora-41-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 22 + fedora42: + number: "42" + distros: + - fedora-42-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 22 + fedora43: + number: "43" + distros: + - fedora-43-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 22 + fedora44: + number: "44" + distros: + - fedora-44-x86_64 + core_image: quay.io/fedora/fedora:{{ spec.number }} + base_image: quay.io/fedora/s2i-core:{{ spec.number }} + suffix: "f{{ spec.number }}" + prod: "fedora{{ spec.number }}" + nodejs_ver: 24 + rhel8: + number: "8" + distros: + - rhel-8-x86_64 + core_image: registry.access.redhat.com/ubi{{ spec.number }}:latest + base_image: ubi{{ spec.number }}/s2i-core + suffix: "el8" + prod: "rhel8" + nodejs_ver: 20 + rhel9: + number: "9" + distros: + - rhel-9-x86_64 + core_image: registry.access.redhat.com/ubi{{ spec.number }}:latest + base_image: ubi{{ spec.number }}/s2i-core + suffix: "el9" + prod: "rhel9" + nodejs_ver: 22 + rhel10: + number: "10" + distros: + - rhel-10-x86_64 + core_image: registry.access.redhat.com/ubi{{ spec.number }}:latest + base_image: ubi{{ spec.number }}/s2i-core + suffix: "el{{ spec.number }}" + prod: "rhel{{ spec.number }}" + nodejs_ver: 22 + c9s: + number: "9" + distros: + - centos-stream-9-x86_64 + suffix: "el{{ spec.number }}" + prod: "c{{ spec.number }}s" + core_image: quay.io/centos/centos:stream{{ spec.number }} + base_image: quay.io/sclorg/s2i-core-{{ spec.prod }}:{{ spec.prod }} + nodejs_ver: 22 + c10s: + number: "10" + distros: + - centos-stream-10-x86_64 + suffix: "el{{ spec.number }}" + prod: "c{{ spec.number }}s" + core_image: quay.io/centos/centos:stream{{ spec.number }} + base_image: quay.io/sclorg/s2i-core-{{ spec.prod }}:{{ spec.prod }} + nodejs_ver: 22 + + version: + "core": + name: "core" + common_image_name: "{{ spec.org }}/postgresql-{{ spec.short }}-{{ spec.prod }}" + rhel_image_name: "rhel8/postgresql-{{ spec.short }}" + latest_fedora: "f44" + + "base": + name: "base" + common_image_name: "{{ spec.org }}/postgresql-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/postgresql-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/postgresql-{{ spec.short }}" + latest_fedora: "f44" + +matrix: + include: + - version: "core" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-38-x86_64 + - fedora-39-x86_64 + - fedora-40-x86_64 + - fedora-41-x86_64 + - fedora-42-x86_64 + - fedora-43-x86_64 + - fedora-44-x86_64 + - version: "base" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-38-x86_64 + - fedora-39-x86_64 + - fedora-40-x86_64 + - fedora-41-x86_64 + - fedora-42-x86_64 + - fedora-43-x86_64 + - fedora-44-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000..efb94d8 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,146 @@ +{% if spec.name == "core" %} +# This image is the base image for all s2i configurable container images. +FROM {{ spec.core_image }} +{% else %} +# This image is the base image for all OpenShift v3 language container images. +FROM {{ spec.base_image }} +{% endif %} + +{% if spec.name == "core" %} +ENV SUMMARY="Base image which allows using of source-to-image." \ + DESCRIPTION="The s2i-core image provides any images layered on top of it \ +with all the tools needed to use source-to-image functionality while keeping \ +the image size as small as possible." \ +{% else %} +ENV SUMMARY="Base image with essential libraries and tools used as a base for \ +builder images like perl, python, ruby, etc." \ + DESCRIPTION="The s2i-base image, being built upon s2i-core, provides any \ +images layered on top of it with all the tools needed to use source-to-image \ +functionality. Additionally, s2i-base also contains various libraries needed for \ +it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER={{ spec.nodejs_ver }} \ +{% endif %} + NAME=s2i-{{ spec.name }} \ + VERSION={{ spec.number }} + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="s2i {{ spec.name }}" \ +{% if spec.name == "core" %} + io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ + io.s2i.scripts-url=image:///usr/libexec/s2i \ +{% endif %} + io.openshift.tags="s2i-{{ spec.name }} {{ spec.prod }}" \ + com.redhat.component="s2i-{{ spec.name }}-container" \ + {% if "rhel" in spec.prod %} + name="ubi{{ spec.number }}/s2i-{{ spec.name }}" \ + {% elif "c" in spec.prod %} + name="sclorg/s2i-{{ spec.name }}-{{ spec.prod }}" \ + {% else %} + name="fedora/s2i-{{ spec.name }}" \ + {% endif %} + version={{ spec.number }} \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" + +{% if spec.name == "core" %} +ENV \ + # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. + STI_SCRIPTS_URL=image:///usr/libexec/s2i \ + # Path to be used in other layers to place s2i scripts into + STI_SCRIPTS_PATH=/usr/libexec/s2i \ + APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications needs this variable + HOME=/opt/app-root/src \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ + PLATFORM="{{ spec.suffix }}" +{% endif %} +# This is the list of basic dependencies that all language container image can +# consume. +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ +{% if spec.name == "core" %} + INSTALL_PKGS="bsdtar \ + findutils \ + gettext \ + glibc-langpack-en \ + groff-base \ + {% if "fedora" in spec.prod %} + python3 \ + {% endif %} + rsync \ + tar \ + unzip" && \ + mkdir -p ${HOME}/.pki/nssdb && \ + chown -R 1001:0 ${HOME}/.pki && \ +{% else %} + {% if spec.prod in ["rhel8", "rhel9", "c9s" ] %} + dnf -y module enable nodejs:$NODEJS_VER && \ + {% endif %} + INSTALL_PKGS="autoconf \ + {% if "fedora" in spec.prod %} + nodejs{{ spec.nodejs_ver }} \ + {% else %} + nodejs \ + {% endif %} + automake \ + bzip2 \ + gcc-c++ \ + gd-devel \ + gdb \ + git \ + libcurl-devel \ + libpq-devel \ + libxml2-devel \ + libxslt-devel \ + lsof \ + make \ + mariadb-connector-c-devel \ + openssl-devel \ + patch \ + procps-ng \ + {% if spec.prod in ["rhel8", "rhel9", "c9s" ] %} + npm \ + {% elif "fedora" in spec.prod %} + nodejs{{ spec.nodejs_ver }}-npm \ + {% else %} + nodejs-npm \ + {% endif %} + redhat-rpm-config \ + sqlite-devel \ + unzip \ + wget \ + which \ + zlib-devel" && \ +{% endif %} + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ +{% if spec.name == "base" %} + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ +{% endif %} + dnf -y clean all --enablerepo='*' +{% if spec.name == "core" %} + +# Copy extra files to the image. +COPY ./core/root/ / + +{% if "fedora" in spec.prod %} +# Create a platform-python symlink if it does not exist already +RUN [ -e /usr/libexec/platform-python ] || ln -s /usr/bin/python3 /usr/libexec/platform-python + +{% endif %} +# Directory with the sources is set as the working directory so all STI scripts +# can execute relative to this path. +WORKDIR ${HOME} + +ENTRYPOINT ["container-entrypoint"] +CMD ["base-usage"] + +# Reset permissions of modified directories and add default user +RUN rpm-file-permissions && \ + useradd -u 1001 -r -g 0 -d ${HOME} -c "Default Application User" default && \ + chown -R 1001:0 ${APP_ROOT} +{% endif %} diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..52556d5 --- /dev/null +++ b/src/README.md @@ -0,0 +1,204 @@ +{% if spec.name == "base" %} +OpenShift base images +======================================== + +This repository contains Dockerfiles for images which serve as base images with all the +essential libraries and tools needed for OpenShift language images, for example: + +* [s2i-ruby](https://github.com/sclorg/s2i-ruby-container) +* [s2i-nodejs](https://github.com/sclorg/s2i-nodejs-container) +* [s2i-python](https://github.com/sclorg/s2i-python-container) +* [s2i-perl](https://github.com/sclorg/s2i-perl-container) +* [s2i-php](https://github.com/sclorg/s2i-php-container) + +This container image also installs several development libraries, that are +often required in the builder images above. It also includes NPM package manager. +Sharing those development packages in a common layer saves disk space and +improves pulling speed. + +NPM, a package manager for Node.js, offers a pleasant way to install JavaScript +libraries, that are often needed as static files for various web applications. +In order to offer good experience for web developers, the NPM package manager +is also installed in the image. + +For containers where the development libraries and NPM package manager are not +necessary, users are advised to use the s2i-core variant of this container image. + + +Description +----------- + +OpenShift S2I images use [Software Collections](https://www.softwarecollections.org/en/) +packages to provide the latest versions of various software. +The SCL packages are released more frequently than the RHEL or CentOS systems, +which are unlikely to change for several years. +We rely on RHEL and CentOS for base images, on the other hand, +because those are stable, supported, and secure platforms. + +Normally, SCL requires manual operation to enable the collection you want to use. +This is burdensome and can be prone to error. +The OpenShift S2I approach is to set Bash environment variables that +serve to automatically enable the desired collection: + +* `BASH_ENV`: enables the collection for all non-interactive Bash sessions +* `ENV`: enables the collection for all invocations of `/bin/sh` +* `PROMPT_COMMAND`: enables the collection in interactive shell + +Two examples: +* If you specify `BASH_ENV`, then all your `#!/bin/bash` scripts +do not need to call `scl enable`. +* If you specify `PROMPT_COMMAND`, then on execution of the +`podman exec ... /bin/bash` command, the collection will be automatically enabled. + +*Note*: +Executables in Software Collections packages (e.g., `ruby`) +are not directly in a directory named in the `PATH` environment variable. +This means that you cannot do: + + $ podman exec ... ruby + +but must instead do: + + $ podman exec ... /bin/bash -c ruby + +The `/bin/bash -c`, along with the setting the appropriate environment variable, +ensures the correct `ruby` executable is found and invoked. + +Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments + +Usage +------------------------ +Choose either the CentOS Stream or RHEL based image: +* **RHEL8 base image** +* **RHEL9 base image** +* **RHEL10 base image** + +To build a RHEL10 based image, you need to build it on properly subscribed RHEL machine. + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=base TARGET=rhel10 +``` + +* **CentOS Stream 9 base image** + +This image is available on DockerHub. To download it run: + +```console +podman pull quay.io/sclorg/s2i-base-c10s +``` + +To build a Base image from scratch run: + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=base TARGET=c10s +``` + +**Notice: By omitting the `VERSION` parameter, the build/test action will be performed +on all provided versions of s2i image.** + + +See also +-------- +Dockerfile and other sources are available on https://github.com/sclorg/s2i-base-container. +In that repository you also can find another variants of S2I base Dockerfiles. +The Dockerfile for RHEL8 is called Dockerfile.rhel8, the Dockerfile for RHEL9 is called Dockerfile.rhel9, +the Dockerfile for RHEL10 is called Dockerfile.rhel10, +the Dockerfile for CentOS Stream 9 is called Dockerfile.c10s, the Dockerfile for CentOS Stream 10 is called Dockerfile.c10s, +and the Dockerfile for Fedora is Dockerfile.fedora. +{% else %} +OpenShift base images (core variant) +======================================== + +This repository contains Dockerfiles for images which can be used as base images +to add support for [source-to-image](https://github.com/openshift/source-to-image) +without installing several development libraries. + + +Description +-------------------------------- +OpenShift S2I images use [Software Collections](https://www.softwarecollections.org/en/) +packages to provide the latest versions of various software. +The SCL packages are released more frequently than the RHEL or CentOS systems, +which are unlikely to change for several years. +We rely on RHEL and CentOS for base images, on the other hand, +because those are stable, supported, and secure platforms. + +Normally, SCL requires manual operation to enable the collection you want to use. +This is burdensome and can be prone to error. +The OpenShift S2I approach is to set Bash environment variables that +serve to automatically enable the desired collection: + +* `BASH_ENV`: enables the collection for all non-interactive Bash sessions +* `ENV`: enables the collection for all invocations of `/bin/sh` +* `PROMPT_COMMAND`: enables the collection in interactive shell + +Two examples: +* If you specify `BASH_ENV`, then all your `#!/bin/bash` scripts +do not need to call `scl enable`. +* If you specify `PROMPT_COMMAND`, then on execution of the +`podman exec ... /bin/bash` command, the collection will be automatically enabled. + +*Note*: +Executables in Software Collections packages (e.g., `ruby`) +are not directly in a directory named in the `PATH` environment variable. +This means that you cannot do: + + $ podman exec ... ruby + +but must instead do: + + $ podman exec ... /bin/bash -c ruby + +The `/bin/bash -c`, along with the setting the appropriate environment variable, +ensures the correct `ruby` executable is found and invoked. + +Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments + +Usage +------------------------ +Choose either the CentOS Stream or RHEL10 base image: +* **RHEL8 base image** +* **RHEL9 base image** +* **RHEL10 base image** + +To build a RHEL10 based image, you need to build it on properly subscribed RHEL machine. + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=core TARGET=rhel10 +``` + +* **CentOS Stream base image** + +This image is available on Quay.io. To download it run: + +```console +podman pull quay.io/sclorg/s2i-core-c10s +``` + +To build a Base image from scratch run: + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=core TARGET=c10s +``` + +**Notice: By omitting the `VERSION` parameter, the build/test action will be performed +on all provided versions of s2i image.** + + +See also +-------- +Dockerfile and other sources are available on https://github.com/sclorg/s2i-base-container. +In that repository you also can find another variants of S2I Base Dockerfiles. +The Dockerfile for RHEL8 is called Dockerfile.rhel8, the Dockerfile for RHEL9 is called Dockerfile.rhel9, +the Dockerfile for RHEL10 is called Dockerfile.rhel10, +the Dockerfile for CentOS Stream 9 is called Dockerfile.c9s, the Dockerfile for CentOS Stream 10 is called Dockerfile.c10s, +and the Dockerfile for Fedora is Dockerfile.fedora. +{% endif %} diff --git a/src/test/__init__.py b/src/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/test/conftest.py b/src/test/conftest.py new file mode 100644 index 0000000..441928e --- /dev/null +++ b/src/test/conftest.py @@ -0,0 +1,32 @@ +import os +import sys +{% if spec.name == "core" %} +import pytest +{% endif %} + +from pathlib import Path +from collections import namedtuple + +from container_ci_suite.utils import check_variables + +if not check_variables(): + sys.exit(1) + + +Vars = namedtuple("Vars", ["OS", "VERSION", "IMAGE_NAME", "TEST_DIR"]) +VERSION = os.getenv("VERSION") +OS = os.getenv("TARGET").lower() + + +VARS = Vars( + OS=OS, + VERSION=VERSION, + IMAGE_NAME=os.getenv("IMAGE_NAME"), + TEST_DIR=Path(__file__).parent.absolute(), +) +{% if spec.name == "core" %} + +def skip_if_not_euid_0(): + if os.geteuid() != 0: + pytest.skip("This test requires root privileges.") +{% endif %} diff --git a/src/test/run b/src/test/run new file mode 100755 index 0000000..46ac2e3 --- /dev/null +++ b/src/test/run @@ -0,0 +1,91 @@ +#!/bin/bash +# +# The 'run' performs a simple test that verifies that S2I image. +# The main focus is that the image prints out the base-usage properly. +# +# IMAGE_NAME specifies a name of the candidate image used for testing. +# The image has to be available before this script is executed. +# +test -n "${IMAGE_NAME-}" || { echo 'make sure $IMAGE_NAME is defined'; exit 1; } + +test_docker_run_usage() { + echo "Testing 'docker run' usage..." + docker run --rm ${IMAGE_NAME} &>/dev/null +} +{% if spec.name == "core" %} +test_cgroup_limits() { + echo "Testing 'cgroup limits' usage..." + if [ $EUID -eq 0 ]; then + echo " The test is running as root, all tests for cgroup limits will be run" + + # check memory limited (only works when running as root) + echo " Testing 'limited memory' usage..." + if ! ( eval $(docker run --rm --memory=512M ${IMAGE_NAME} /usr/bin/cgroup-limits) + echo "MEMORY_LIMIT_IN_BYTES=$MEMORY_LIMIT_IN_BYTES" + [ "$MEMORY_LIMIT_IN_BYTES" -eq 536870912 ] ); then + echo "MEMORY_LIMIT_IN_BYTES not set to 536870912." + return 1 + fi + + # check cores number (only works when running as root) + echo " Testing 'NUMBER_OF_CORES' value..." + if ! ( eval $(docker run --rm ${IMAGE_NAME} /usr/bin/cgroup-limits) + echo "NUMBER_OF_CORES=$NUMBER_OF_CORES" + [ "$NUMBER_OF_CORES" -gt 0 ] ); then + echo "NUMBER_OF_CORES not set." + return 1 + fi + + # check cores number (only works when running as root) + echo " Testing 'NUMBER_OF_CORES' value with --cpuset-cpus=0..." + if ! ( eval $(docker run --rm --cpuset-cpus=0 ${IMAGE_NAME} /usr/bin/cgroup-limits) + echo "NUMBER_OF_CORES=$NUMBER_OF_CORES" + [ "$NUMBER_OF_CORES" -eq 1 ] ); then + echo "NUMBER_OF_CORES not set to 1 when set --cpuset-cpus=0." + return 1 + fi + + else + echo " The test is running as non-root, some tests for cgroup limits are skipped" + fi + + # check NO_MEMORY_LIMIT when no limit is set + echo " Testing 'NO_MEMORY_LIMIT' value..." + if ! ( eval $(docker run --rm ${IMAGE_NAME} /usr/bin/cgroup-limits) + echo "NO_MEMORY_LIMIT=$NO_MEMORY_LIMIT" + [ "$NO_MEMORY_LIMIT" == 'true' ] ); then + echo "NO_MEMORY_LIMIT not set to true." + return 1 + fi + + # check default memory in bytes + echo " Testing 'MEMORY_LIMIT_IN_BYTES' value..." + if ! ( eval $(docker run --rm ${IMAGE_NAME} /usr/bin/cgroup-limits) + echo "MEMORY_LIMIT_IN_BYTES=$MEMORY_LIMIT_IN_BYTES" + # This value can be different, but it must be very big (comparing to 10TB) + [ "$MEMORY_LIMIT_IN_BYTES" -gt 10000000000000 ] ); then + echo "MEMORY_LIMIT_IN_BYTES not greater than 10000000000000." + return 1 + fi +} +{% endif %} + +check_result() { + local result="$1" + if [[ "$result" != "0" ]]; then + echo "S2I image '${IMAGE_NAME}' test FAILED (exit code: ${result})" + exit $result + fi +} + +# Verify the 'usage' script is working properly when running the base image with 'docker run ...' +test_docker_run_usage +check_result $? +{% if spec.name == "core" %} +# Verify the cgroup-limits script works as expected +test_cgroup_limits +check_result $? +{% endif %} +echo "Tests for '${IMAGE_NAME}' succeeded." + +# vim: set tabstop=2:shiftwidth=2:expandtab: diff --git a/src/test/run-pytest b/src/test/run-pytest new file mode 100755 index 0000000..69484a0 --- /dev/null +++ b/src/test/run-pytest @@ -0,0 +1,18 @@ +#!/bin/bash +# +# IMAGE_NAME specifies a name of the candidate image used for testing. +# The image has to be available before this script is executed. +# SINGLE_VERSION specifies the major version of httpd +# OS specifies RHEL version (e.g. OS=rhel8) +# + +THISDIR=$(dirname ${BASH_SOURCE[0]}) + +git show -s + +if python3 -c 'import sys; sys.exit(0 if sys.version_info < (3,13) else 1)'; then + PYTHON_VERSION="3.12" +else + PYTHON_VERSION="3" +fi +cd "${THISDIR}" && "python${PYTHON_VERSION}" -m pytest -s -rA --showlocals -vv test_container_*.py diff --git a/src/test/test_container_basics.py b/src/test/test_container_basics.py new file mode 100644 index 0000000..8a86753 --- /dev/null +++ b/src/test/test_container_basics.py @@ -0,0 +1,99 @@ +{% if spec.name == "base" %} +from container_ci_suite.container_lib import ContainerTestLib +from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper + +from conftest import VARS + + +class TestS2IBaseContainer: + + def setup_method(self): + self.app = ContainerTestLib(image_name=VARS.IMAGE_NAME, s2i_image=True) + + def teardown_method(self): + self.app.cleanup() + + def test_docker_run_usage(self): + """ + Test if podman run works properly + """ + assert PodmanCLIWrapper.call_podman_command( + cmd=f"run --rm {VARS.IMAGE_NAME} &>/dev/null", + return_output=False + ) == 0 +{% else %} +import re + +from container_ci_suite.container_lib import ContainerTestLib +from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper + +from conftest import VARS, skip_if_not_euid_0 + + +class TestS2ICoreContainer: + def setup_method(self): + self.app = ContainerTestLib(image_name=VARS.IMAGE_NAME, s2i_image=True) + + def teardown_method(self): + self.app.cleanup() + + def test_docker_run_usage(self): + """ + Test if podman run works properly + """ + assert ( + PodmanCLIWrapper.call_podman_command( + cmd=f"run --rm {VARS.IMAGE_NAME} &>/dev/null", return_output=False + ) + == 0 + ) + + def test_cgroup_limits_memory_limit_in_bytes(self): + skip_if_not_euid_0() + # check memory limited (only works when running as root) + memory_limit_in_bytes = 536870912 + output = PodmanCLIWrapper.podman_run_command( + cmd=f"--rm --memory=512M {VARS.IMAGE_NAME} /usr/bin/cgroup-limits" + ) + assert f"MEMORY_LIMIT_IN_BYTES={memory_limit_in_bytes}" in output, ( + f"MEMORY_LIMIT_IN_BYTES not set to {memory_limit_in_bytes}." + ) + + def test_cgroup_limits_number_of_cores(self): + skip_if_not_euid_0() + # check cores number (only works when running as root) + output = PodmanCLIWrapper.podman_run_command( + cmd=f"--rm {VARS.IMAGE_NAME} /usr/bin/cgroup-limits" + ) + assert re.search(r"NUMBER_OF_CORES=[1-9]\d*", output), ( + "NUMBER_OF_CORES not set." + ) + + def test_cgroup_limits_number_of_cores_with_cpuset_cpus(self): + skip_if_not_euid_0() + # check cores number (only works when running as root) + output = PodmanCLIWrapper.podman_run_command( + cmd=f"--rm --cpuset-cpus=0 {VARS.IMAGE_NAME} /usr/bin/cgroup-limits" + ) + assert "NUMBER_OF_CORES=1" in output, "NUMBER_OF_CORES not set to 1." + + def test_cgroup_limits_no_memory_limit(self): + # check NO_MEMORY_LIMIT when no limit is set + output = PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=VARS.IMAGE_NAME, cmd="/usr/bin/cgroup-limits" + ) + assert "NO_MEMORY_LIMIT=true" in output, "NO_MEMORY_LIMIT not set to true." + + def test_cgroup_limits_memory_limit_in_bytes_max(self): + # check NO_MEMORY_LIMIT when no limit is set + output = PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=VARS.IMAGE_NAME, cmd="/usr/bin/cgroup-limits" + ) + assert "MEMORY_LIMIT_IN_BYTES=" in output, ( + "MEMORY_LIMIT_IN_BYTES not in cgroup-limits" + ) + limit_in_bytes = output.split("MEMORY_LIMIT_IN_BYTES=")[1].strip() + assert int(limit_in_bytes) > 10**13, ( + "MEMORY_LIMIT_IN_BYTES not greater than 10^13." + ) +{% endif %} From 0412400924f89fb39c92c4d6fe0e9f5042446cf7 Mon Sep 17 00:00:00 2001 From: Petr Khartskhaev Date: Tue, 14 Jul 2026 13:02:01 +0200 Subject: [PATCH 2/3] Update distgen-generated files --- base/.exclude-c8s | 0 base/Dockerfile.c10s | 24 ++++++++++----- base/Dockerfile.c8s | 51 ------------------------------- base/Dockerfile.c9s | 28 ++++++++++------- base/Dockerfile.f38 | 28 +++++++++++------ base/Dockerfile.f39 | 28 +++++++++++------ base/Dockerfile.f40 | 33 +++++++++++++------- base/Dockerfile.f41 | 33 +++++++++++++------- base/Dockerfile.f42 | 33 +++++++++++++------- base/Dockerfile.f43 | 33 +++++++++++++------- base/Dockerfile.f44 | 33 +++++++++++++------- base/Dockerfile.rhel10 | 16 +++++++--- base/Dockerfile.rhel8 | 21 +++++++++---- base/Dockerfile.rhel9 | 20 +++++++++---- base/root | 1 + base/test/conftest.py | 7 ++--- base/test/run | 19 +++++++----- core/.exclude-c8s | 0 core/Dockerfile.c10s | 20 ++++++------- core/Dockerfile.c8s | 68 ------------------------------------------ core/Dockerfile.c9s | 23 +++++++------- core/Dockerfile.f38 | 25 ++++++++-------- core/Dockerfile.f39 | 25 ++++++++-------- core/Dockerfile.f40 | 25 ++++++++-------- core/Dockerfile.f41 | 24 +++++++-------- core/Dockerfile.f42 | 24 +++++++-------- core/Dockerfile.f43 | 24 +++++++-------- core/Dockerfile.f44 | 24 +++++++-------- core/Dockerfile.rhel10 | 14 ++++----- core/Dockerfile.rhel8 | 29 +++++++++--------- core/Dockerfile.rhel9 | 28 ++++++++--------- core/test/conftest.py | 1 - core/test/run | 3 -- 33 files changed, 378 insertions(+), 387 deletions(-) delete mode 100644 base/.exclude-c8s delete mode 100644 base/Dockerfile.c8s create mode 120000 base/root delete mode 100644 core/.exclude-c8s delete mode 100644 core/Dockerfile.c8s diff --git a/base/.exclude-c8s b/base/.exclude-c8s deleted file mode 100644 index e69de29..0000000 diff --git a/base/Dockerfile.c10s b/base/Dockerfile.c10s index c28507e..e395cb6 100644 --- a/base/Dockerfile.c10s +++ b/base/Dockerfile.c10s @@ -8,20 +8,28 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ NODEJS_VER=22 \ - NAME=s2i-base + NAME=s2i-base \ + VERSION=10 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME-container" \ - name="sclorg/$NAME-c10s" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base c10s" \ + com.redhat.component="s2i-base-container" \ + name="sclorg/s2i-base-c10s" \ + version=10 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs \ automake \ bzip2 \ gcc-c++ \ @@ -44,8 +52,8 @@ RUN INSTALL_PKGS="autoconf \ unzip \ wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.c8s b/base/Dockerfile.c8s deleted file mode 100644 index 22f59b8..0000000 --- a/base/Dockerfile.c8s +++ /dev/null @@ -1,51 +0,0 @@ -# This image is the base image for all OpenShift v3 language container images. -FROM quay.io/sclorg/s2i-core-c8s:c8s - -ENV SUMMARY="Base image with essential libraries and tools used as a base for \ -builder images like perl, python, ruby, etc." \ - DESCRIPTION="The s2i-base image, being built upon s2i-core, provides any \ -images layered on top of it with all the tools needed to use source-to-image \ -functionality. Additionally, s2i-base also contains various libraries needed for \ -it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ - NODEJS_VER=20 - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="s2i base" \ - com.redhat.component="s2i-base-container" \ - name="sclorg/s2i-base-c8s" \ - version="1" \ - maintainer="SoftwareCollections.org " - -# This is the list of basic dependencies that all language container image can -# consume. -RUN yum -y module enable nodejs:$NODEJS_VER && \ - INSTALL_PKGS="autoconf \ - automake \ - bzip2 \ - gcc-c++ \ - gd-devel \ - gdb \ - git \ - libcurl-devel \ - libpq-devel \ - libxml2-devel \ - libxslt-devel \ - lsof \ - make \ - mariadb-connector-c-devel \ - openssl-devel \ - patch \ - procps-ng \ - npm \ - redhat-rpm-config \ - sqlite-devel \ - unzip \ - wget \ - which \ - zlib-devel" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ - yum -y clean all --enablerepo='*' diff --git a/base/Dockerfile.c9s b/base/Dockerfile.c9s index 84d3795..9b4bf63 100644 --- a/base/Dockerfile.c9s +++ b/base/Dockerfile.c9s @@ -8,21 +8,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ NODEJS_VER=22 \ - NAME=s2i-base + NAME=s2i-base \ + VERSION=9 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME-container" \ - name="sclorg/$NAME-c9s" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base c9s" \ + com.redhat.component="s2i-base-container" \ + name="sclorg/s2i-base-c9s" \ + version=9 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN yum -y module enable nodejs:$NODEJS_VER && \ - INSTALL_PKGS="nodejs autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + dnf -y module enable nodejs:$NODEJS_VER && \ + INSTALL_PKGS="autoconf \ + nodejs \ automake \ bzip2 \ gcc-c++ \ @@ -46,7 +54,7 @@ RUN yum -y module enable nodejs:$NODEJS_VER && \ wget \ which \ zlib-devel" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ - yum -y clean all --enablerepo='*' + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f38 b/base/Dockerfile.f38 index 8601132..2263ef5 100644 --- a/base/Dockerfile.f38 +++ b/base/Dockerfile.f38 @@ -7,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=18 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=38 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora38" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=38 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs18 \ automake \ bzip2 \ gcc-c++ \ @@ -35,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs18-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ wget \ which \ zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f39 b/base/Dockerfile.f39 index d99fe4d..eb2bfa1 100644 --- a/base/Dockerfile.f39 +++ b/base/Dockerfile.f39 @@ -7,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=20 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=39 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora39" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=39 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs20 \ automake \ bzip2 \ gcc-c++ \ @@ -35,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs20-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ wget \ which \ zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f40 b/base/Dockerfile.f40 index eea9c2c..1c99af1 100644 --- a/base/Dockerfile.f40 +++ b/base/Dockerfile.f40 @@ -1,3 +1,4 @@ +# This image is the base image for all OpenShift v3 language container images. FROM quay.io/fedora/s2i-core:40 ENV SUMMARY="Base image with essential libraries and tools used as a base for \ @@ -6,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=20 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=40 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora40" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=40 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs20 \ automake \ bzip2 \ gcc-c++ \ @@ -34,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs20-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ - wget2 \ + wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f41 b/base/Dockerfile.f41 index 98bc789..9e2e322 100644 --- a/base/Dockerfile.f41 +++ b/base/Dockerfile.f41 @@ -1,3 +1,4 @@ +# This image is the base image for all OpenShift v3 language container images. FROM quay.io/fedora/s2i-core:41 ENV SUMMARY="Base image with essential libraries and tools used as a base for \ @@ -6,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=22 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=41 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora41" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=41 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs22 \ automake \ bzip2 \ gcc-c++ \ @@ -34,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs22-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ - wget2 \ + wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f42 b/base/Dockerfile.f42 index 3a825eb..041cb1d 100644 --- a/base/Dockerfile.f42 +++ b/base/Dockerfile.f42 @@ -1,3 +1,4 @@ +# This image is the base image for all OpenShift v3 language container images. FROM quay.io/fedora/s2i-core:42 ENV SUMMARY="Base image with essential libraries and tools used as a base for \ @@ -6,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=22 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=42 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora42" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=42 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs22 \ automake \ bzip2 \ gcc-c++ \ @@ -34,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs22-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ - wget2 \ + wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f43 b/base/Dockerfile.f43 index 6f1d56f..d48a97e 100644 --- a/base/Dockerfile.f43 +++ b/base/Dockerfile.f43 @@ -1,3 +1,4 @@ +# This image is the base image for all OpenShift v3 language container images. FROM quay.io/fedora/s2i-core:43 ENV SUMMARY="Base image with essential libraries and tools used as a base for \ @@ -6,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=22 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=43 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora43" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=43 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs22 \ automake \ bzip2 \ gcc-c++ \ @@ -34,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs-npm \ openssl-devel \ patch \ procps-ng \ + nodejs22-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ - wget2 \ + wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.f44 b/base/Dockerfile.f44 index a5a8a63..757551a 100644 --- a/base/Dockerfile.f44 +++ b/base/Dockerfile.f44 @@ -1,3 +1,4 @@ +# This image is the base image for all OpenShift v3 language container images. FROM quay.io/fedora/s2i-core:44 ENV SUMMARY="Base image with essential libraries and tools used as a base for \ @@ -6,21 +7,29 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NODEJS_VER=24 \ NAME=s2i-base \ - ARCH=x86_64 + VERSION=44 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-base fedora44" \ + com.redhat.component="s2i-base-container" \ + name="fedora/s2i-base" \ + version=44 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs24 \ automake \ bzip2 \ gcc-c++ \ @@ -34,15 +43,17 @@ lsof \ make \ mariadb-connector-c-devel \ - nodejs24-npm \ openssl-devel \ patch \ procps-ng \ + nodejs24-npm \ + redhat-rpm-config \ sqlite-devel \ unzip \ - wget2 \ + wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.rhel10 b/base/Dockerfile.rhel10 index 3ca0e97..cf6660f 100644 --- a/base/Dockerfile.rhel10 +++ b/base/Dockerfile.rhel10 @@ -8,7 +8,8 @@ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ NODEJS_VER=22 \ - NAME=s2i-base + NAME=s2i-base \ + VERSION=10 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -17,11 +18,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="s2i-base rhel10" \ com.redhat.component="s2i-base-container" \ name="ubi10/s2i-base" \ + version=10 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN INSTALL_PKGS="autoconf \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + INSTALL_PKGS="autoconf \ + nodejs \ automake \ bzip2 \ gcc-c++ \ @@ -44,8 +52,8 @@ RUN INSTALL_PKGS="autoconf \ unzip \ wget \ which \ - zlib-ng-compat-devel" && \ + zlib-devel" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.rhel8 b/base/Dockerfile.rhel8 index 1b991c6..1fdcd71 100644 --- a/base/Dockerfile.rhel8 +++ b/base/Dockerfile.rhel8 @@ -7,21 +7,30 @@ builder images like perl, python, ruby, etc." \ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ - NODEJS_VER=20 + NODEJS_VER=20 \ + NAME=s2i-base \ + VERSION=8 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="s2i base" \ + io.openshift.tags="s2i-base rhel8" \ com.redhat.component="s2i-base-container" \ name="ubi8/s2i-base" \ - version="1" \ + version=8 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN yum -y module enable nodejs:$NODEJS_VER && \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + dnf -y module enable nodejs:$NODEJS_VER && \ INSTALL_PKGS="autoconf \ + nodejs \ automake \ bzip2 \ gcc-c++ \ @@ -45,7 +54,7 @@ RUN yum -y module enable nodejs:$NODEJS_VER && \ wget \ which \ zlib-devel" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ - yum -y clean all --enablerepo='*' + dnf -y clean all --enablerepo='*' diff --git a/base/Dockerfile.rhel9 b/base/Dockerfile.rhel9 index b8da3e6..1b1004e 100644 --- a/base/Dockerfile.rhel9 +++ b/base/Dockerfile.rhel9 @@ -7,7 +7,9 @@ builder images like perl, python, ruby, etc." \ images layered on top of it with all the tools needed to use source-to-image \ functionality. Additionally, s2i-base also contains various libraries needed for \ it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ - NODEJS_VER=22 + NODEJS_VER=22 \ + NAME=s2i-base \ + VERSION=9 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -16,13 +18,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="s2i-base rhel9" \ com.redhat.component="s2i-base-container" \ name="ubi9/s2i-base" \ - version="1" \ + version=9 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" # This is the list of basic dependencies that all language container image can # consume. -RUN yum -y module enable nodejs:$NODEJS_VER && \ +# Also setup the 'openshift' user that is used for the build execution and for the +# application runtime execution. +# TODO: Use better UID and GID values + +RUN \ + dnf -y module enable nodejs:$NODEJS_VER && \ INSTALL_PKGS="autoconf \ + nodejs \ automake \ bzip2 \ gcc-c++ \ @@ -46,7 +54,7 @@ RUN yum -y module enable nodejs:$NODEJS_VER && \ wget \ which \ zlib-devel" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VER\." && echo "Found VERSION $NODEJS_VER" && \ - yum -y clean all --enablerepo='*' + dnf -y clean all --enablerepo='*' diff --git a/base/root b/base/root new file mode 120000 index 0000000..9495ee6 --- /dev/null +++ b/base/root @@ -0,0 +1 @@ +../common/shared-scripts/core \ No newline at end of file diff --git a/base/test/conftest.py b/base/test/conftest.py index 5772de7..b38b9c7 100644 --- a/base/test/conftest.py +++ b/base/test/conftest.py @@ -9,11 +9,8 @@ if not check_variables(): sys.exit(1) -Vars = namedtuple( - "Vars", [ - "OS", "VERSION", "IMAGE_NAME", "TEST_DIR" - ] -) + +Vars = namedtuple("Vars", ["OS", "VERSION", "IMAGE_NAME", "TEST_DIR"]) VERSION = os.getenv("VERSION") OS = os.getenv("TARGET").lower() diff --git a/base/test/run b/base/test/run index ba51036..10d5d82 100755 --- a/base/test/run +++ b/base/test/run @@ -1,6 +1,6 @@ #!/bin/bash # -# The 'run' performs a simple test that verifies that STI image. +# The 'run' performs a simple test that verifies that S2I image. # The main focus is that the image prints out the base-usage properly. # # IMAGE_NAME specifies a name of the candidate image used for testing. @@ -9,18 +9,21 @@ test -n "${IMAGE_NAME-}" || { echo 'make sure $IMAGE_NAME is defined'; exit 1; } test_docker_run_usage() { - echo "Testing 'docker run' usage..." - docker run --rm ${IMAGE_NAME} &>/dev/null + echo "Testing 'docker run' usage..." + docker run --rm ${IMAGE_NAME} &>/dev/null } check_result() { - local result="$1" - if [[ "$result" != "0" ]]; then - echo "STI image '${IMAGE_NAME}' test FAILED (exit code: ${result})" - exit $result - fi + local result="$1" + if [[ "$result" != "0" ]]; then + echo "S2I image '${IMAGE_NAME}' test FAILED (exit code: ${result})" + exit $result + fi } # Verify the 'usage' script is working properly when running the base image with 'docker run ...' test_docker_run_usage check_result $? +echo "Tests for '${IMAGE_NAME}' succeeded." + +# vim: set tabstop=2:shiftwidth=2:expandtab: diff --git a/core/.exclude-c8s b/core/.exclude-c8s deleted file mode 100644 index e69de29..0000000 diff --git a/core/Dockerfile.c10s b/core/Dockerfile.c10s index b878d1d..4dd5ba4 100644 --- a/core/Dockerfile.c10s +++ b/core/Dockerfile.c10s @@ -14,10 +14,11 @@ LABEL summary="$SUMMARY" \ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME-container" \ - name="sclorg/$NAME-c10s" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core c10s" \ + com.redhat.component="s2i-core-container" \ + name="sclorg/s2i-core-c10s" \ + version=10 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -27,28 +28,27 @@ ENV \ APP_ROOT=/opt/app-root \ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ PLATFORM="el10" - # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ rsync \ tar \ - unzip \ - yum" && \ + unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ dnf -y clean all --enablerepo='*' # Copy extra files to the image. diff --git a/core/Dockerfile.c8s b/core/Dockerfile.c8s deleted file mode 100644 index 4ea9ff9..0000000 --- a/core/Dockerfile.c8s +++ /dev/null @@ -1,68 +0,0 @@ -# This image is the base image for all s2i configurable container images. -FROM quay.io/centos/centos:stream8 - -ENV SUMMARY="Base image which allows using of source-to-image." \ - DESCRIPTION="The s2i-core image provides any images layered on top of it \ -with all the tools needed to use source-to-image functionality while keeping \ -the image size as small as possible." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="s2i core" \ - io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ - io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="s2i-core-container" \ - name="sclorg/s2i-core-c8s" \ - version="1" \ - maintainer="SoftwareCollections.org " - -ENV \ - # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. - STI_SCRIPTS_URL=image:///usr/libexec/s2i \ - # Path to be used in other layers to place s2i scripts into - STI_SCRIPTS_PATH=/usr/libexec/s2i \ - APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications needs this variable - HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ - PLATFORM="el8" - -# This is the list of basic dependencies that all language container image can -# consume. -# Also setup the 'openshift' user that is used for the build execution and for the -# application runtime execution. -# TODO: Use better UID and GID values - -RUN INSTALL_PKGS="bsdtar \ - findutils \ - groff-base \ - glibc-locale-source \ - glibc-langpack-en \ - gettext \ - rsync \ - scl-utils \ - tar \ - unzip \ - xz \ - yum" && \ - mkdir -p ${HOME}/.pki/nssdb && \ - chown -R 1001:0 ${HOME}/.pki && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' - -# Copy extra files to the image. -COPY ./core/root/ / - -# Directory with the sources is set as the working directory so all STI scripts -# can execute relative to this path. -WORKDIR ${HOME} - -ENTRYPOINT ["container-entrypoint"] -CMD ["base-usage"] - -# Reset permissions of modified directories and add default user -RUN rpm-file-permissions && \ - useradd -u 1001 -r -g 0 -d ${HOME} -c "Default Application User" default && \ - chown -R 1001:0 ${APP_ROOT} diff --git a/core/Dockerfile.c9s b/core/Dockerfile.c9s index 1723284..a90ce3e 100644 --- a/core/Dockerfile.c9s +++ b/core/Dockerfile.c9s @@ -14,10 +14,11 @@ LABEL summary="$SUMMARY" \ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME-container" \ - name="sclorg/$NAME-c9s" \ - version="$VERSION" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core c9s" \ + com.redhat.component="s2i-core-container" \ + name="sclorg/s2i-core-c9s" \ + version=9 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -27,31 +28,27 @@ ENV \ APP_ROOT=/opt/app-root \ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ PLATFORM="el9" - # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ - glibc-locale-source \ rsync \ - scl-utils \ tar \ - unzip \ - xz \ - yum" && \ + unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ dnf -y clean all --enablerepo='*' # Copy extra files to the image. diff --git a/core/Dockerfile.f38 b/core/Dockerfile.f38 index 4660c23..3d95418 100644 --- a/core/Dockerfile.f38 +++ b/core/Dockerfile.f38 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=38 \ - ARCH=x86_64 + VERSION=38 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora38" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=38 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,26 +29,28 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f38" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ + python3 \ rsync \ tar \ unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f39 b/core/Dockerfile.f39 index a4be684..8ae55c0 100644 --- a/core/Dockerfile.f39 +++ b/core/Dockerfile.f39 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=39 \ - ARCH=x86_64 + VERSION=39 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora39" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=39 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,26 +29,28 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f39" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ + python3 \ rsync \ tar \ unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f40 b/core/Dockerfile.f40 index 6f10016..2c19b5b 100644 --- a/core/Dockerfile.f40 +++ b/core/Dockerfile.f40 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=40 \ - ARCH=x86_64 + VERSION=40 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora40" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=40 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,26 +29,28 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f40" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ + python3 \ rsync \ tar \ unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f41 b/core/Dockerfile.f41 index 7a016ed..d3a7610 100644 --- a/core/Dockerfile.f41 +++ b/core/Dockerfile.f41 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=41 \ - ARCH=x86_64 + VERSION=41 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora41" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=41 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,14 +29,15 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f41" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ @@ -49,8 +49,8 @@ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f42 b/core/Dockerfile.f42 index 7583631..ae64419 100644 --- a/core/Dockerfile.f42 +++ b/core/Dockerfile.f42 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=42 \ - ARCH=x86_64 + VERSION=42 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora42" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=42 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,14 +29,15 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f42" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ @@ -49,8 +49,8 @@ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f43 b/core/Dockerfile.f43 index 3d43d78..ce89e5f 100644 --- a/core/Dockerfile.f43 +++ b/core/Dockerfile.f43 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=43 \ - ARCH=x86_64 + VERSION=43 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora43" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=43 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,14 +29,15 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f43" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ @@ -49,8 +49,8 @@ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.f44 b/core/Dockerfile.f44 index 805ebc4..07d533b 100644 --- a/core/Dockerfile.f44 +++ b/core/Dockerfile.f44 @@ -6,8 +6,7 @@ with all the tools needed to use source-to-image functionality while keeping \ the image size as small as possible." \ NAME=s2i-core \ - VERSION=44 \ - ARCH=x86_64 + VERSION=44 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,11 +14,11 @@ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ - com.redhat.component="$NAME" \ - name="fedora/$NAME" \ - version="$VERSION" \ - usage="This image is supposed to be used as a base image for other images that support source-to-image" \ - maintainer="SoftwareCollections.org " + io.openshift.tags="s2i-core fedora44" \ + com.redhat.component="s2i-core-container" \ + name="fedora/s2i-core" \ + version=44 \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ # DEPRECATED: Use above LABEL instead, because this will be removed in future versions. @@ -30,14 +29,15 @@ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ - PLATFORM="fedora" - + PLATFORM="f44" # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ + +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ @@ -49,8 +49,8 @@ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all -y + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.rhel10 b/core/Dockerfile.rhel10 index 1c2ecd4..e3c2b03 100644 --- a/core/Dockerfile.rhel10 +++ b/core/Dockerfile.rhel10 @@ -1,5 +1,5 @@ # This image is the base image for all s2i configurable container images. -FROM ubi10:latest +FROM registry.access.redhat.com/ubi10:latest ENV SUMMARY="Base image which allows using of source-to-image." \ DESCRIPTION="The s2i-core image provides any images layered on top of it \ @@ -17,6 +17,7 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="s2i-core rhel10" \ com.redhat.component="s2i-core-container" \ name="ubi10/s2i-core" \ + version=10 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ @@ -27,28 +28,27 @@ ENV \ APP_ROOT=/opt/app-root \ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ PLATFORM="el10" - # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ gettext \ glibc-langpack-en \ groff-base \ rsync \ tar \ - unzip \ - yum" && \ + unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ dnf -y clean all --enablerepo='*' # Copy extra files to the image. diff --git a/core/Dockerfile.rhel8 b/core/Dockerfile.rhel8 index 8c827ea..a79dd95 100644 --- a/core/Dockerfile.rhel8 +++ b/core/Dockerfile.rhel8 @@ -4,7 +4,9 @@ FROM registry.access.redhat.com/ubi8:latest ENV SUMMARY="Base image which allows using of source-to-image." \ DESCRIPTION="The s2i-core image provides any images layered on top of it \ with all the tools needed to use source-to-image functionality while keeping \ -the image size as small as possible." +the image size as small as possible." \ + NAME=s2i-core \ + VERSION=8 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -12,9 +14,10 @@ LABEL summary="$SUMMARY" \ io.k8s.display-name="s2i core" \ io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \ io.s2i.scripts-url=image:///usr/libexec/s2i \ + io.openshift.tags="s2i-core rhel8" \ com.redhat.component="s2i-core-container" \ name="ubi8/s2i-core" \ - version="1" \ + version=8 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ @@ -25,32 +28,28 @@ ENV \ APP_ROOT=/opt/app-root \ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ PLATFORM="el8" - # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ - groff-base \ - glibc-locale-source \ - glibc-langpack-en \ gettext \ + glibc-langpack-en \ + groff-base \ rsync \ - scl-utils \ tar \ - unzip \ - xz \ - yum" && \ + unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/Dockerfile.rhel9 b/core/Dockerfile.rhel9 index 771a443..48bad89 100644 --- a/core/Dockerfile.rhel9 +++ b/core/Dockerfile.rhel9 @@ -4,7 +4,9 @@ FROM registry.access.redhat.com/ubi9:latest ENV SUMMARY="Base image which allows using of source-to-image." \ DESCRIPTION="The s2i-core image provides any images layered on top of it \ with all the tools needed to use source-to-image functionality while keeping \ -the image size as small as possible." +the image size as small as possible." \ + NAME=s2i-core \ + VERSION=9 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -15,7 +17,7 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="s2i-core rhel9" \ com.redhat.component="s2i-core-container" \ name="ubi9/s2i-core" \ - version="1" \ + version=9 \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" ENV \ @@ -26,32 +28,28 @@ ENV \ APP_ROOT=/opt/app-root \ # The $HOME is not set by default, but some applications needs this variable HOME=/opt/app-root/src \ - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \ PLATFORM="el9" - # This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. # TODO: Use better UID and GID values -RUN INSTALL_PKGS="bsdtar \ +RUN \ + INSTALL_PKGS="bsdtar \ findutils \ - groff-base \ - glibc-locale-source \ - glibc-langpack-en \ gettext \ + glibc-langpack-en \ + groff-base \ rsync \ - scl-utils \ tar \ - unzip \ - xz \ - yum" && \ + unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ chown -R 1001:0 ${HOME}/.pki && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + #rpm -V $INSTALL_PKGS && \ + dnf -y clean all --enablerepo='*' # Copy extra files to the image. COPY ./core/root/ / diff --git a/core/test/conftest.py b/core/test/conftest.py index 562ade5..70f6f90 100644 --- a/core/test/conftest.py +++ b/core/test/conftest.py @@ -23,7 +23,6 @@ TEST_DIR=Path(__file__).parent.absolute(), ) - def skip_if_not_euid_0(): if os.geteuid() != 0: pytest.skip("This test requires root privileges.") diff --git a/core/test/run b/core/test/run index 6878bf3..2e60130 100755 --- a/core/test/run +++ b/core/test/run @@ -12,7 +12,6 @@ test_docker_run_usage() { echo "Testing 'docker run' usage..." docker run --rm ${IMAGE_NAME} &>/dev/null } - test_cgroup_limits() { echo "Testing 'cgroup limits' usage..." if [ $EUID -eq 0 ]; then @@ -80,11 +79,9 @@ check_result() { # Verify the 'usage' script is working properly when running the base image with 'docker run ...' test_docker_run_usage check_result $? - # Verify the cgroup-limits script works as expected test_cgroup_limits check_result $? - echo "Tests for '${IMAGE_NAME}' succeeded." # vim: set tabstop=2:shiftwidth=2:expandtab: From 31b484329e6a19ff10973d3f9f91c2bce7f7c110 Mon Sep 17 00:00:00 2001 From: Petr Khartskhaev Date: Tue, 28 Jul 2026 09:17:07 +0200 Subject: [PATCH 3/3] common submodule updated --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 0bd53a3..300f499 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 0bd53a383270457da180fdb05c8c2bc734bbe6e3 +Subproject commit 300f499e1f4f0fdc5d9b4b470977cc39000810f3