From 141fe7f94a48e04bc80d94cb30d1b27cebd8b4d5 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 2 Jul 2024 12:48:31 +0200 Subject: [PATCH 1/3] Remove support for RHEL-7 and CentOS 7 Signed-off-by: Petr "Stone" Hracek --- .github/workflows/container-tests.yml | 12 ++++-------- betka.py | 14 ++------------ build.sh | 9 ++------- check_imagestreams.py | 3 --- common.mk | 13 +------------ show_all_imagestreams.py | 3 --- test-lib-openshift.sh | 6 +++--- test-lib-remote-openshift.sh | 4 +--- test-lib.sh | 6 +----- test.sh | 2 +- tests/check_betka.sh | 6 +++--- tests/check_imagestreams.sh | 2 +- tests/failures/check/v0/Dockerfile | 2 -- tests/failures/check/v0/Dockerfile.rhel7 | 2 -- tests/imagestreams/testing_file.json | 6 +++--- tests/test-lib/image_availability | 12 +++--------- tests/test-lib/public_image_name | 6 +++--- 17 files changed, 28 insertions(+), 80 deletions(-) delete mode 100644 tests/failures/check/v0/Dockerfile delete mode 100644 tests/failures/check/v0/Dockerfile.rhel7 diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index 7a485f41..100eb132 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: container-to-test: ["postgresql-container", "nginx-container", "s2i-perl-container", "s2i-python-container", "s2i-base-container" ] - os: ["fedora", "c9s", "rhel7", "rhel8", "rhel9", "c10s"] + os: ["fedora", "c9s", "rhel8", "rhel9", "c10s"] if: | github.event.issue.pull_request @@ -53,16 +53,12 @@ jobs: fi fi else - if [ "${{ matrix.os }}" == "rhel7" ]; then - compose="RHEL-7.9-Released" - context="RHEL7" - tmt_plan="rhel7-docker" - elif [ "${{ matrix.os }}" == "rhel8" ]; then - compose="RHEL-8.6.0-Nightly" + if [ "${{ matrix.os }}" == "rhel8" ]; then + compose="RHEL-8.10.0-Nightly" context="RHEL8" tmt_plan="rhel8-docker" else - compose="RHEL-9.1.0-Nightly" + compose="RHEL-9.4.0-Nightly" context="RHEL9" tmt_plan="rhel9-docker" fi diff --git a/betka.py b/betka.py index 00cca136..4a934179 100644 --- a/betka.py +++ b/betka.py @@ -116,14 +116,6 @@ def __init__(self) -> None: self.ups_sources = "" def check_requirements(self) -> bool: - if self.os_env == "centos7": - msg = """ -'centos7' target is not supported. -Target has to be e.g. rhel7, rhel8, rhel9 or fedora. -e.g. make betka TARGET=fedora VERSIONS=XY - """ - logging.info(msg) - return False if not self.cwt_docker_image: msg = """ Docker image for generating dist-git sources for RHEL has to be specified. @@ -196,9 +188,7 @@ def get_valid_images(self, ver: str) -> List[str]: def convert_branch_to_cwt_tool(self) -> bool: assert isinstance(self.downstream_branch, str) fields = self.downstream_branch.split("-") - if self.os_env == "rhel7": - self.cwt_config = f"rhel7.yaml:{fields[0]}{fields[1].replace('.','')}0" - elif self.os_env == "rhel8": + if self.os_env == "rhel8": release_fields = fields[1].split(".") self.cwt_config = ( f"rhel8.yaml:{fields[0]}{release_fields[0]}.{release_fields[1]}" @@ -210,7 +200,7 @@ def convert_branch_to_cwt_tool(self) -> bool: ) else: logging.info( - f"No proper OS target was selected {self.os_env}. Possible are 'rhel7, rhel8, and rhel9." + f"No proper OS target was selected {self.os_env}. Possible are 'rhel8, and rhel9." ) return False return True diff --git a/build.sh b/build.sh index afe0ab35..b6d7c2fd 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ # This script is used to build the OpenShift Docker images. # -# OS - Specifies distribution - "rhel7", "rhel8", "rhel9", "centos7", "c9s", "c10s" or "fedora" +# OS - Specifies distribution - "rhel8", "rhel9", "c9s", "c10s" or "fedora" # VERSION - Specifies the image version - (must match with subdirectory in repo) # SINGLE_VERSION - Specifies the image version - (must match with subdirectory in repo) # VERSIONS - Must be set to a list with possible versions (subdirectories) @@ -220,11 +220,6 @@ echo "Built versions are: $dirs" for dir in ${dirs}; do pushd "${dir}" > /dev/null - if [ "$OS" == "centos7" ] || [ "$OS" == "centos7-candidate" ]; then - docker_build_with_version Dockerfile - else - docker_build_with_version Dockerfile."$OS" - fi - + docker_build_with_version Dockerfile."$OS" popd > /dev/null done diff --git a/check_imagestreams.py b/check_imagestreams.py index a10476bb..6ddaef32 100755 --- a/check_imagestreams.py +++ b/check_imagestreams.py @@ -82,9 +82,6 @@ def check_imagestreams(self) -> int: print(f"No json files present in {IMAGESTREAMS_DIR}.") return 0 for f in json_files: - if os.environ.get("TARGET") in ("rhel7", "centos7") and "aarch64" in str(f): - print("Imagestream aarch64 is not supported on rhel7") - continue print(f"Checking file {str(f)}.") json_dict = self.load_json_file(f) if not (self.check_version(json_dict) and self.check_latest_tag(json_dict)): diff --git a/common.mk b/common.mk index 71fa4e24..88bea947 100644 --- a/common.mk +++ b/common.mk @@ -38,29 +38,18 @@ ifeq ($(TARGET),rhel8) else ifeq ($(TARGET),rhel9) OS := rhel9 DOCKERFILE ?= Dockerfile.rhel9 -else ifeq ($(TARGET),rhel7) - SKIP_SQUASH ?= 0 - OS := rhel7 - DOCKERFILE ?= Dockerfile.rhel7 else ifeq ($(TARGET),fedora) OS := fedora DOCKERFILE ?= Dockerfile.fedora REGISTRY := quay.io/ -else ifeq ($(TARGET),centos6) - OS := centos6 - DOCKERFILE ?= Dockerfile.centos6 else ifeq ($(TARGET),c9s) OS := c9s DOCKERFILE ?= Dockerfile.c9s REGISTRY := quay.io/ -else ifeq ($(TARGET),c10s) +else OS := c10s DOCKERFILE ?= Dockerfile.c10s REGISTRY := quay.io/ -else - OS := centos7 - DOCKERFILE ?= Dockerfile - REGISTRY := quay.io/ endif SKIP_SQUASH ?= 1 diff --git a/show_all_imagestreams.py b/show_all_imagestreams.py index 1becffe8..d8022764 100755 --- a/show_all_imagestreams.py +++ b/show_all_imagestreams.py @@ -46,9 +46,6 @@ def show_all_imagestreams(self) -> int: print(f"No json files present in {IMAGESTREAMS_DIR}.") return 0 for f in json_files: - if os.environ.get("TARGET") in ("rhel7", "centos7") and "aarch64" in str(f): - print("Imagestream aarch64 is not supported on rhel7") - continue json_dict = self.load_json_file(f) print(f"Tags in the image stream {f}:") for tag in json_dict["spec"]["tags"]: diff --git a/test-lib-openshift.sh b/test-lib-openshift.sh index ea83f989..d65d3a1d 100644 --- a/test-lib-openshift.sh +++ b/test-lib-openshift.sh @@ -37,7 +37,7 @@ function ct_os_cleanup() { # Check the compulsory variables: # * IMAGE_NAME specifies a name of the candidate image used for testing. # * VERSION specifies the major version of the MariaDB in format of X.Y -# * OS specifies RHEL version (e.g. OS=rhel7) +# * OS specifies RHEL version (e.g. OS=rhel8) function ct_os_check_compulsory_vars() { # shellcheck disable=SC2016 test -n "${IMAGE_NAME-}" || ( echo 'make sure $IMAGE_NAME is defined' >&2 ; exit 1) @@ -325,8 +325,8 @@ function ct_os_deploy_s2i_image() { # Arguments: template - prefix or whole ID of the pod to run the cmd in # Arguments: env_params - environment variables parameters for the template. # Example usage: ct_os_deploy_template_image mariadb-ephemeral-template.yaml \ -# DATABASE_SERVICE_NAME=mysql-57-centos7 \ -# DATABASE_IMAGE=mysql-57-centos7 \ +# DATABASE_SERVICE_NAME=mysql-80-c9s \ +# DATABASE_IMAGE=mysql-80-c9s \ # MYSQL_USER=testu \ # MYSQL_PASSWORD=testp \ # MYSQL_DATABASE=testdb diff --git a/test-lib-remote-openshift.sh b/test-lib-remote-openshift.sh index 58b22d82..8b51cbec 100644 --- a/test-lib-remote-openshift.sh +++ b/test-lib-remote-openshift.sh @@ -82,9 +82,7 @@ function ct_os_tag_image_for_cvp() { fi local tag_image_name="$1" local tag="" - if [ "${OS}" == "rhel7" ]; then - tag="-el7" - elif [ "${OS}" == "rhel8" ]; then + if [ "${OS}" == "rhel8" ]; then tag="-el8" elif [ "${OS}" == "rhel9" ]; then tag="-el9" diff --git a/test-lib.sh b/test-lib.sh index 6026a0a4..4de6f590 100644 --- a/test-lib.sh +++ b/test-lib.sh @@ -806,14 +806,10 @@ ct_get_public_image_name() { local registry registry=$(ct_registry_from_os "$os") - if [ "$os" == "rhel7" ]; then - public_image_name=$registry/rhscl/$base_image_name-${version//./}-rhel7 - elif [ "$os" == "rhel8" ]; then + if [ "$os" == "rhel8" ]; then public_image_name=$registry/rhel8/$base_image_name-${version//./} elif [ "$os" == "rhel9" ]; then public_image_name=$registry/rhel9/$base_image_name-${version//./} - elif [ "$os" == "centos7" ]; then - public_image_name=$registry/centos7/$base_image_name-${version//./}-centos7:centos7 elif [ "$os" == "c9s" ]; then public_image_name=$registry/sclorg/$base_image_name-${version//./}-c9s elif [ "$os" == "c10s" ]; then diff --git a/test.sh b/test.sh index 76fe5646..770de04c 100755 --- a/test.sh +++ b/test.sh @@ -40,7 +40,7 @@ for dir in ${VERSIONS}; do # Kept also IMAGE_NAME as some tests might still use that. IMAGE_NAME="$(docker inspect -f "{{.Config.Labels.name}}" "$IMAGE_ID"):$IMAGE_VERSION" # shellcheck disable=SC2268 - if [ "${OS}" == "centos7" ] || [ "${OS}" == "c9s" ] || [ "${OS}" == "c10s" ] || [ "${OS}" == "fedora" ]; then + if [ "${OS}" == "c9s" ] || [ "${OS}" == "c10s" ] || [ "${OS}" == "fedora" ]; then export IMAGE_NAME="$REGISTRY$IMAGE_NAME" else export IMAGE_NAME diff --git a/tests/check_betka.sh b/tests/check_betka.sh index e92c83ec..32fa486d 100644 --- a/tests/check_betka.sh +++ b/tests/check_betka.sh @@ -17,13 +17,13 @@ OS=fedora DOWNSTREAM_BRANCH=f32 bash $betka test $? -eq 1 # DOCKER_IMAGE is missing -bash $betka OS=rhel7 +bash $betka OS=rhel8 test $? -eq 1 # DOWNSTREAM_NAME is missing -bash $betka OS=rhel7 DOCKER_IMAGE="quay.io/rhscl/dummy" +bash $betka OS=rhel8 DOCKER_IMAGE="quay.io/rhscl/dummy" test $? -eq 1 # DOWNSTREAM_BRANCH is missing -bash $betka OS=rhel7 DOCKER_IMAGE="quay.io/rhscl/dummy" DOWNSTREAM_NAME="foo_test" +bash $betka OS=rhel8 DOCKER_IMAGE="quay.io/rhscl/dummy" DOWNSTREAM_NAME="foo_test" test $? -eq 1 diff --git a/tests/check_imagestreams.sh b/tests/check_imagestreams.sh index 2987a1fc..c12963c1 100755 --- a/tests/check_imagestreams.sh +++ b/tests/check_imagestreams.sh @@ -12,4 +12,4 @@ test $? -eq 0 echo "This tests check if 'show_all_imagestreams.py' returns proper output" output=$("${PYTHON-python3}" "$show_all_imagestreams") test "${output#*"- latest -> 2.4"}" != "$output" && echo "latest found in the output" -test "${output#*"- 2.4 -> registry.redhat.io/rhscl/httpd-24-rhel7"}" != "$output" && echo "2.4 found in the output" +test "${output#*"- 2.4-el8 -> registry.redhat.io/rhel8/httpd-24"}" != "$output" && echo "2.4 found in the output" diff --git a/tests/failures/check/v0/Dockerfile b/tests/failures/check/v0/Dockerfile deleted file mode 100644 index 1fb2bd26..00000000 --- a/tests/failures/check/v0/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM quay.io/centos7/s2i-core-centos7:centos7 -LABEL name=test-image diff --git a/tests/failures/check/v0/Dockerfile.rhel7 b/tests/failures/check/v0/Dockerfile.rhel7 deleted file mode 100644 index af62ae5d..00000000 --- a/tests/failures/check/v0/Dockerfile.rhel7 +++ /dev/null @@ -1,2 +0,0 @@ -FROM rhscl/s2i-core-rhel7 -LABEL name=test-image diff --git a/tests/imagestreams/testing_file.json b/tests/imagestreams/testing_file.json index adfad36e..6b3e9089 100644 --- a/tests/imagestreams/testing_file.json +++ b/tests/imagestreams/testing_file.json @@ -30,7 +30,7 @@ }, { "annotations": { - "description": "Build and serve static content via Apache HTTP Server (httpd) 2.4 on RHEL 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/httpd-container/blob/master/2.4/README.md.", + "description": "Build and serve static content via Apache HTTP Server (httpd) 2.4 on RHEL 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/httpd-container/blob/master/2.4/README.md.", "iconClass": "icon-apache", "openshift.io/display-name": "Apache HTTP Server 2.4", "openshift.io/provider-display-name": "Red Hat, Inc.", @@ -41,12 +41,12 @@ }, "from": { "kind": "DockerImage", - "name": "registry.redhat.io/rhscl/httpd-24-rhel7" + "name": "registry.redhat.io/rhel8/httpd-24" }, "referencePolicy": { "type": "Local" }, - "name": "2.4" + "name": "2.4-el8" } ] } diff --git a/tests/test-lib/image_availability b/tests/test-lib/image_availability index d1c0ecd1..2406aa72 100755 --- a/tests/test-lib/image_availability +++ b/tests/test-lib/image_availability @@ -5,25 +5,19 @@ set -e . test-lib.sh # This should succeed -if ! ct_pull_image quay.io/centos7/ruby-27-centos7:centos7; then +if ! ct_pull_image quay.io/sclorg/ruby-27-c9s:c9s; then echo "image_availability test failed" false fi # This should fail -if ct_pull_image quay.io/centos7/ruby-24-centos7:centos7 false 1; then +if ct_pull_image quay.io/sclorg/ruby-24-c9s:c9s false 1; then echo "image_availability test failed" false fi # This should succeed -if ! ct_check_image_availability quay.io/centos7/ruby-27-centos7:centos7; then - echo "check_image_availability test failed" - false -fi - -# This should fail -if ct_check_image_availability quay.io/centos7/ruby-24-centos7:centos7; then +if ! ct_check_image_availability quay.io/sclorg/python-27-c9s:c9s; then echo "check_image_availability test failed" false fi diff --git a/tests/test-lib/public_image_name b/tests/test-lib/public_image_name index c9001ac1..00c2d168 100755 --- a/tests/test-lib/public_image_name +++ b/tests/test-lib/public_image_name @@ -4,9 +4,9 @@ set -e . test-lib.sh -combinations="rhel7:registry.redhat.io/rhscl/postgresql-10-rhel7 -centos7:quay.io/centos7/postgresql-10-centos7:centos7 -rhel8:registry.redhat.io/rhel8/postgresql-10 +combinations="c9s:quay.io/c9s/postgresql-15-c9s:c9s +rhel8:registry.redhat.io/rhel8/postgresql-15 +rhel9:registry.redhat.io/rhel9/postgresql-15 " for c in $combinations; do From 0ba98f0dea075ea2682eebdbe0b5ee405bab3940 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 2 Jul 2024 12:48:52 +0200 Subject: [PATCH 2/3] Update README and betka.py Remove RHEL-7 and CentOS-7 Signed-off-by: Petr "Stone" Hracek --- README.md | 12 ++++++------ betka.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 76d962c4..b4888c94 100644 --- a/README.md +++ b/README.md @@ -35,14 +35,14 @@ This rule will run the testsuite scripts contained in the container source repos It expects the test to be available at `$gitroot/$version/test/run` Depends on `tag` as some tests might need to have the images tagged (s2i). -`make test-openshift` -Similar to `make test` but runs testsuite for Openshift 3, expected to be found at -`$gitroot/$version/test/run-openshift` - `make test-openshift-4` Similar to `make test` but runs testsuite for Openshift 4, expected to be found at `$gitroot/$version/test/run-openshift-remote-cluster` +`make test-openshift-pytest` +Similar to `make test` but runs PyTest test suite `https://github.com/sclorg/container-ci-suite` for Openshift 4, +expected to be found at `$gitroot/$version/test/run-openshift-pytest` + `make betka` Runs script betka.sh that generates sources for the dist-git repo. Only Fedora, RHEL7 and RHEL8 are supported. @@ -53,7 +53,7 @@ for RHEL world please ask pkubat@redhat.com, phracek@redhat.com, or hhorak@redha E.g. command for the source generation into Fedora dist-repo `https://src.fedoraproject.org/container/nodejs` into main branch is: -`make betka TARGET=fedora VERSIONS=12` +`make betka TARGET=fedora VERSIONS=20` The sources are not generated directly into dist-git repository, but into created `results` directory. @@ -85,7 +85,7 @@ Dockerfile for the scripts to know which versions to build. `OS` OS version you want to build the images for. Currently the scripts are able to build for -centos (default), c9s, c10s, rhel7, rhel8, rhel9, and fedora. +centos (default), c9s, c10s, rhel8, rhel9, and fedora. `SKIP_SQUASH` When set to 1 the build script will skip the squash phase of the build. diff --git a/betka.py b/betka.py index 4a934179..3d681688 100644 --- a/betka.py +++ b/betka.py @@ -141,8 +141,8 @@ def check_requirements(self) -> bool: msg = """ DOWNSTREAM_BRANCH is not specified. Examples: -rhel-8.3.0 for RHEL8 -rhscl-3.6-rhel7 for RHEL7 +rhel-9.4.0 for RHEL9 +rhel-8.8.0 for RHEL8 For more details ask pkubat@redhat.com or phracek@redhat.com """ logging.info(msg) From 9b00dd80ffdca004be153cc25363e053d6201abe Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 3 Jul 2024 09:22:27 +0200 Subject: [PATCH 3/3] Fix image_availability test. add echo in case test passed Signed-off-by: Petr "Stone" Hracek --- tests/failures/check/v0/Dockerfile.c10s | 2 +- tests/test-lib/image_availability | 22 +++++++++++++++++++--- tests/test-lib/public_image_name | 4 ++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/failures/check/v0/Dockerfile.c10s b/tests/failures/check/v0/Dockerfile.c10s index 4e904091..70343144 100644 --- a/tests/failures/check/v0/Dockerfile.c10s +++ b/tests/failures/check/v0/Dockerfile.c10s @@ -1,2 +1,2 @@ -FROM quay.io/sclorg/s2i-core-c10s +FROM quay.io/sclorg/s2i-core-c9s LABEL name=test-image diff --git a/tests/test-lib/image_availability b/tests/test-lib/image_availability index 2406aa72..f725e019 100755 --- a/tests/test-lib/image_availability +++ b/tests/test-lib/image_availability @@ -5,21 +5,37 @@ set -e . test-lib.sh # This should succeed -if ! ct_pull_image quay.io/sclorg/ruby-27-c9s:c9s; then +if ! ct_pull_image quay.io/sclorg/mysql-80-c9s:c9s; then echo "image_availability test failed" false +else + echo "image_availability test passed for 'ct_pull_image quay.io/sclorg/mysql-80-c9s:c9s'" fi # This should fail -if ct_pull_image quay.io/sclorg/ruby-24-c9s:c9s false 1; then +if ct_pull_image quay.io/sclorg/postgresql-96-c9s:c9s false 1; then echo "image_availability test failed" false +else + echo "image_availability test passed for 'ct_pull_image quay.io/sclorg/postgresql-96-c9s:c9s false 1'" fi # This should succeed -if ! ct_check_image_availability quay.io/sclorg/python-27-c9s:c9s; then +if ! ct_check_image_availability quay.io/sclorg/postgresql-15-c9s:c9s; then echo "check_image_availability test failed" false +else + echo "check_image_availability test passed for 'ct_check_image_availability quay.io/sclorg/postgresql-15-c9s:c9s'" fi +# This should fail +if ct_check_image_availability quay.io/sclorg/python-27-c9s:c9s; then + echo "check_image_availability test failed" + false +else + echo "check_image_availability test passed for 'ct_check_image_availability quay.io/sclorg/python-27-c9s:c9s'" +fi + + + echo "image_availability test completed successfully." diff --git a/tests/test-lib/public_image_name b/tests/test-lib/public_image_name index 00c2d168..e9cd6474 100755 --- a/tests/test-lib/public_image_name +++ b/tests/test-lib/public_image_name @@ -4,13 +4,13 @@ set -e . test-lib.sh -combinations="c9s:quay.io/c9s/postgresql-15-c9s:c9s +combinations="c9s:quay.io/sclorg/postgresql-15-c9s rhel8:registry.redhat.io/rhel8/postgresql-15 rhel9:registry.redhat.io/rhel9/postgresql-15 " for c in $combinations; do - public_name=$(ct_get_public_image_name "${c%%:*}" postgresql 10) + public_name=$(ct_get_public_image_name "${c%%:*}" postgresql 15) [ "$public_name" == "${c#*:}" ] done