diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index adb6407..6a7bc74 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -14,14 +14,6 @@ jobs: fail-fast: false matrix: include: - - dockerfile: "5.30/Dockerfile" - docker_context: "5.30" - registry_namespace: "centos7" - tag: "centos7" - image_name: "perl-530-centos7" - quayio_username: "QUAY_IMAGE_BUILDER_USERNAME" - quayio_token: "QUAY_IMAGE_BUILDER_TOKEN" - - dockerfile: "5.32/Dockerfile.c9s" docker_context: "5.32" registry_namespace: "sclorg" @@ -30,22 +22,6 @@ jobs: quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" - - dockerfile: "5.32/Dockerfile.fedora" - docker_context: "5.32" - registry_namespace: "fedora" - tag: "5.32" - image_name: "perl-532" - quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME" - quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN" - - - dockerfile: "5.34/Dockerfile.fedora" - docker_context: "5.34" - registry_namespace: "fedora" - tag: "5.34" - image_name: "perl-534" - quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME" - quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN" - - dockerfile: "5.36/Dockerfile.fedora" docker_context: "5.36" registry_namespace: "fedora" diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index 006b38c..718a199 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.30-mod_fcgid", "5.32", "5.34", "5.36" ] - os_test: [ "fedora", "centos7", "rhel7", "rhel8", "rhel9", "c9s" ] + os_test: [ "fedora", "rhel7", "rhel8", "rhel9", "c9s" ] test_case: [ "container" ] if: | diff --git a/.github/workflows/openshift-tests.yml b/.github/workflows/openshift-tests.yml index dbf39a5..81c03e5 100644 --- a/.github/workflows/openshift-tests.yml +++ b/.github/workflows/openshift-tests.yml @@ -11,11 +11,9 @@ jobs: fail-fast: false matrix: version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.30-mod_fcgid", "5.32", "5.34", "5.36" ] - os_test: [ "centos7", "rhel7", "rhel8", "rhel9"] + os_test: [ "rhel7", "rhel8", "rhel9"] test_case: [ "openshift-3", "openshift-4" ] exclude: - - test_case: "openshift-4" - os_test: "centos7" - test_case: "openshift-3" os_test: "rhel8" - test_case: "openshift-3" diff --git a/5.16/Dockerfile b/5.16/Dockerfile deleted file mode 100644 index 9ffaf0b..0000000 --- a/5.16/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM openshift/base-centos7 - -# This image provides a Perl 5.16 environment you can use to run your Perl applications. -MAINTAINER SoftwareCollections.org - -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.16 \ - PATH=$PATH:/opt/rh/perl516/root/usr/local/bin - -LABEL io.k8s.description="Platform for building and running Perl 5.1.6 applications" \ - io.k8s.display-name="Apache 2.4 with mod_perl/5.1.6" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,perl,perl516" - -# TODO: Cleanup cpanp cache after cpanminus is installed? -RUN yum install -y centos-release-scl && \ - INSTALL_PKGS="httpd24 perl516 perl516-mod_perl perl516-perl-CPANPLUS" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' && \ - scl enable perl516 -- cpanp 's conf prereqs 1; s save system' && \ - scl enable perl516 -- cpanp 's conf allow_build_interactivity 0; s save system' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p /opt/app-root/etc/httpd.d && \ - sed -i -f /opt/app-root/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd /opt/app-root/etc/httpd.d && \ - chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.16/Dockerfile.rhel7 b/5.16/Dockerfile.rhel7 deleted file mode 100644 index 826fdd0..0000000 --- a/5.16/Dockerfile.rhel7 +++ /dev/null @@ -1,52 +0,0 @@ -FROM openshift/base-rhel7 - -# This image provides a Perl 5.16 environment you can use to run your Perl applications. -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.16 \ - PATH=$PATH:/opt/rh/perl516/root/usr/local/bin - -LABEL io.k8s.description="Platform for building and running Perl 5.1.6 applications" \ - io.k8s.display-name="Apache 2.4 with mod_perl/5.1.6" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,perl,perl516" - -# Labels consumed by Red Hat build service -LABEL com.redhat.component="openshift-sti-perl-docker" \ - name="openshift3/perl-516-rhel7" \ - version="5.16" \ - release="1" \ - architecture="x86_64" - -# TODO: Cleanup cpanp cache after cpanminus is installed? -# To use subscription inside container yum command has to be run first (before yum-config-manager) -# https://access.redhat.com/solutions/1443553 -RUN yum repolist > /dev/null && \ - yum-config-manager --enable rhel-server-rhscl-7-rpms && \ - yum-config-manager --enable rhel-7-server-optional-rpms && \ - INSTALL_PKGS="httpd24 perl516 perl516-mod_perl perl516-perl-CPANPLUS" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' && \ - scl enable perl516 -- cpanp 's conf prereqs 1; s save system' && \ - scl enable perl516 -- cpanp 's conf allow_build_interactivity 0; s save system' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p /opt/app-root/etc/httpd.d && \ - sed -i -f /opt/app-root/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd /opt/app-root/etc/httpd.d && \ - chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.16/README.md b/5.16/README.md deleted file mode 100644 index ddf47d1..0000000 --- a/5.16/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Perl container image -==================== - -**The Perl 5.16 image is deprecated.** diff --git a/5.16/cccp.yml b/5.16/cccp.yml deleted file mode 100644 index 44564d3..0000000 --- a/5.16/cccp.yml +++ /dev/null @@ -1,3 +0,0 @@ -# This is for the purpose of building this container on -# the CentOS Container Pipeline. -job-id: perl-516-centos7 diff --git a/5.16/root/opt/app-root/etc/httpd.conf b/5.16/root/opt/app-root/etc/httpd.conf deleted file mode 100644 index e79b195..0000000 --- a/5.16/root/opt/app-root/etc/httpd.conf +++ /dev/null @@ -1,17 +0,0 @@ -LoadModule perl_module modules/mod_perl.so -DirectoryIndex index.pl - -PerlSwitches -I./extlib/lib/perl5 - - - SetHandler perl-script - PerlResponseHandler ModPerl::PerlRun - Options +ExecCGI +SymLinksIfOwnerMatch - PerlSendHeader On - - - - Require all granted - - -IncludeOptional /opt/app-root/etc/httpd.d/*.conf diff --git a/5.16/root/opt/app-root/etc/httpd.d/50-mpm.conf.template b/5.16/root/opt/app-root/etc/httpd.d/50-mpm.conf.template deleted file mode 100644 index ca18659..0000000 --- a/5.16/root/opt/app-root/etc/httpd.d/50-mpm.conf.template +++ /dev/null @@ -1,11 +0,0 @@ -# This value should mirror what is set in MinSpareServers. -StartServers ${HTTPD_START_SERVERS} -MinSpareServers ${HTTPD_START_SERVERS} -MaxSpareServers ${HTTPD_MAX_SPARE_SERVERS} -# The MaxRequestWorkers directive sets the limit on the number of -# simultaneous requests that will be served. -# The default value, when no cgroup limits are set is 256. -MaxRequestWorkers ${HTTPD_MAX_REQUEST_WORKERS} -ServerLimit ${HTTPD_MAX_REQUEST_WORKERS} -MaxConnectionsPerChild 4000 -MaxKeepAliveRequests 100 diff --git a/5.16/root/opt/app-root/etc/httpdconf.sed b/5.16/root/opt/app-root/etc/httpdconf.sed deleted file mode 100644 index 609e8ad..0000000 --- a/5.16/root/opt/app-root/etc/httpdconf.sed +++ /dev/null @@ -1,7 +0,0 @@ -s/^Listen 80/Listen 0.0.0.0:8080/ -s/^User apache/User default/ -s/^Group apache/Group root/ -s%^DocumentRoot "/opt/rh/httpd24/root/var/www/html"%DocumentRoot "/opt/app-root/src"% -s%^ Installing application source ..." -mv /tmp/src/* ./ - -if [ -d ./cfg ]; then - echo "---> Copying configuration files..." - if [ "$(ls -A ./cfg/*.conf)" ]; then - cp -v ./cfg/*.conf /opt/app-root/etc/httpd.d/ - fi -fi - -# Allow for http proxy to be specified in uppercase -if [[ -n "${HTTP_PROXY:-}" && -z "${http_proxy:-}" ]]; then - export http_proxy=$HTTP_PROXY -fi - -export CPAN_MIRROR=${CPAN_MIRROR:-""} - -MIRROR_ARGS="" - -if [ -n "$CPAN_MIRROR" ]; then - MIRROR_ARGS="--mirror $CPAN_MIRROR" -fi - -# Don't test installed Perl modules by default -if [ "${ENABLE_CPAN_TEST}" = true ]; then - export ENABLE_CPAN_TEST="" -else - export ENABLE_CPAN_TEST="--notest" -fi - -# Installing dependencies with cpanfile -if [ -f "cpanfile" ]; then - # Install cpanm - echo "---> Installing cpanminus 1.7102 ..." - curl -sSkL https://raw.githubusercontent.com/miyagawa/cpanminus/1.7102/cpanm |\ - perl - App::cpanminus - CPANM="./perl5/bin/cpanm" - echo "---> Installing modules from cpanfile ..." - perl $CPANM $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib Module::CoreList - perl -Iextlib/lib/perl5 $CPANM $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib --installdeps . -else - echo "---> No cpanfile found, nothing to install" -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/5.16/s2i/bin/run b/5.16/s2i/bin/run deleted file mode 100755 index b2b3e78..0000000 --- a/5.16/s2i/bin/run +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -# Warning: Please note that this will pass all environment variables available within the -# container to mod_perl by means of PerlPassEnv in the env.conf file -if [ ! -f /opt/app-root/etc/httpd.d/env.conf ]; then - env | awk -F'=' '{print "PerlPassEnv "$1}' > /opt/app-root/etc/httpd.d/env.conf -fi - -# Enable automatic reloading. This can be useful for debugging an application. -PERL_APACHE2_RELOAD=${PERL_APACHE2_RELOAD:-} -if [[ "${PERL_APACHE2_RELOAD,,}" == "true" ]]; then - cat > /opt/app-root/etc/httpd.d/50-autoreload.conf < 0 ? MAX_SERVER_LIMIT : 1)) - export HTTPD_MAX_REQUEST_WORKERS=$((MAX_SERVER_LIMIT > 256 ? 256 : MAX_SERVER_LIMIT)) -fi - -export HTTPD_START_SERVERS=${HTTPD_START_SERVERS:-8} -export HTTPD_MAX_SPARE_SERVERS=$((HTTPD_START_SERVERS+10)) - -envsubst < /opt/app-root/etc/httpd.d/50-mpm.conf.template > /opt/app-root/etc/httpd.d/50-mpm.conf - -exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND diff --git a/5.16/s2i/bin/usage b/5.16/s2i/bin/usage deleted file mode 100755 index 3cc3730..0000000 --- a/5.16/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat </dev/null -} - -container_exists() { - image_exists $(cat $cid_file) -} - -container_ip() { - docker inspect --format="{{ .NetworkSettings.IPAddress }}" $(cat $cid_file) -} - -run_s2i_build() { - s2i build ${s2i_args} file://${test_dir}/sample-test-app ${IMAGE_NAME} ${IMAGE_NAME}-testapp -} - -prepare() { - if ! image_exists ${IMAGE_NAME}; then - echo "ERROR: The image ${IMAGE_NAME} must exist before this script is executed." - exit 1 - fi - # TODO: S2I build require the application is a valid 'GIT' repository, we - # should remove this restriction in the future when a file:// is used. - info "Build the test application image" - pushd ${test_dir}/sample-test-app >/dev/null - git init - git config user.email "build@localhost" && git config user.name "builder" - git add -A && git commit -m "Sample commit" - popd >/dev/null -} - -run_test_application() { - docker run --user=100001 --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp -} - -cleanup_test_app() { - info "Cleaning up the test application" - if [ -f $cid_file ]; then - if container_exists; then - docker stop $(cat $cid_file) - docker rm $(cat $cid_file) - fi - rm $cid_file - fi -} - -cleanup() { - info "Cleaning up the test application image" - if image_exists ${IMAGE_NAME}-testapp; then - docker rmi -f ${IMAGE_NAME}-testapp - fi - rm -rf ${test_dir}/sample-test-app/.git -} - -check_result() { - local result="$1" - if [[ "$result" != "0" ]]; then - info "TEST FAILED (${result})" - cleanup - exit $result - fi -} - -wait_for_cid() { - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - info "Waiting for application container to start" - while [ $attempt -le $max_attempts ]; do - [ -f $cid_file ] && [ -s $cid_file ] && break - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done -} - -test_s2i_usage() { - info "Testing 's2i usage'" - s2i usage ${s2i_args} ${IMAGE_NAME} &>/dev/null -} - -test_docker_run_usage() { - info "Testing 'docker run' usage" - docker run ${IMAGE_NAME} &>/dev/null -} - -test_scl_usage() { - local run_cmd="$1" - local expected="$2" - - info "Testing the image SCL enable" - out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}") - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/bash -c "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/sh -ic "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/sh -ic "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi -} - -test_connection() { - info "Testing the HTTP connection (http://$(container_ip):${test_port})" - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - while [ $attempt -le $max_attempts ]; do - response_code=$(curl -s -w %{http_code} -o /dev/null http://$(container_ip):${test_port}/) - status=$? - if [ $status -eq 0 ]; then - if [ $response_code -eq 200 ]; then - result=0 - fi - break - fi - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done - return $result -} - -test_application() { - # Verify that the HTTP connection can be established to test application container - run_test_application & - - # Wait for the container to write it's CID file - wait_for_cid - - test_scl_usage "perl --version" "v5.16.3" - check_result $? - - test_connection - check_result $? - cleanup_test_app -} - -cid_file=$(mktemp -u --suffix=.cid) - -# Since we built the candidate image locally, we don't want S2I attempt to pull -# it from Docker hub -s2i_args="--force-pull=false" - -prepare -run_s2i_build -check_result $? - -# Verify the 'usage' script is working properly when running the base image with 's2i usage ...' -test_s2i_usage -check_result $? - -# Verify the 'usage' script is working properly when running the base image with 'docker run ...' -test_docker_run_usage -check_result $? - -# Test application with default UID -test_application - -# Test application with random UID -CONTAINER_ARGS="-u 12345" test_application - -info "All tests for the sample-test-app finished successfully." -cleanup - -info "All tests finished successfully." diff --git a/5.16/test/sample-test-app/cpanfile b/5.16/test/sample-test-app/cpanfile deleted file mode 100644 index f703b78..0000000 --- a/5.16/test/sample-test-app/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Math::Round', '== 0.06'; \ No newline at end of file diff --git a/5.16/test/sample-test-app/index.pl b/5.16/test/sample-test-app/index.pl deleted file mode 100755 index 9115498..0000000 --- a/5.16/test/sample-test-app/index.pl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl - -use Math::Round; - -round(10.2) == 10 || die "round(10.2) != 10"; - -print "Content-type: text/html\n\n"; -print < -Everything is OK - -Everything is fine. - - -EOF -; \ No newline at end of file diff --git a/5.20/Dockerfile b/5.20/Dockerfile deleted file mode 100644 index 435b6a2..0000000 --- a/5.20/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -FROM centos/s2i-base-centos7 - -# This image provides a Perl 5.20 environment you can use to run your Perl applications. - -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.20 \ - PERL_SHORT_VER=520 \ - NAME=perl - -ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \ - DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \ -building and running various Perl $PERL_VERSION applications and frameworks. \ -Perl is a high-level programming language with roots in C, sed, awk and shell scripting. \ -Perl is good at handling processes and files, and is especially good at handling text. \ -Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \ -different things, Perl's most common applications are system administration utilities \ -and web programming." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Apache 2.4 with mod_perl/$PERL_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,${NAME},${NAME}${PERL_SHORT_VER}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - name="centos/${NAME}-${PERL_SHORT_VER}-centos7" \ - com.redhat.component="rh-${NAME}${PERL_SHORT_VER}-docker" \ - version="$PERL_VERSION" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-${NAME}-container" \ - usage="s2i build centos/${NAME}-${PERL_SHORT_VER}-centos7:latest " - -# TODO: Cleanup cpanp cache after cpanminus is installed? -RUN yum install -y centos-release-scl && \ - INSTALL_PKGS="rh-perl520 rh-perl520-perl-devel rh-perl520-mod_perl rh-perl520-perl-CPAN" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \ - sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \ - chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ - ENV=${APP_ROOT}/etc/scl_enable \ - PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.20/Dockerfile.rhel7 b/5.20/Dockerfile.rhel7 deleted file mode 100644 index 5f22638..0000000 --- a/5.20/Dockerfile.rhel7 +++ /dev/null @@ -1,67 +0,0 @@ -FROM rhscl/s2i-base-rhel7 - -# This image provides a Perl 5.20 environment you can use to run your Perl applications. - -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.20 \ - PERL_SHORT_VER=520 \ - NAME=perl - -ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \ - DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \ -building and running various Perl $PERL_VERSION applications and frameworks. \ -Perl is a high-level programming language with roots in C, sed, awk and shell scripting. \ -Perl is good at handling processes and files, and is especially good at handling text. \ -Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \ -different things, Perl's most common applications are system administration utilities \ -and web programming." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Apache 2.4 with mod_perl/$PERL_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,${NAME},${NAME}${PERL_SHORT_VER}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - name="rhscl/${NAME}-${PERL_SHORT_VER}-rhel7" \ - com.redhat.component="rh-${NAME}${PERL_SHORT_VER}-docker" \ - version="$PERL_VERSION" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-${NAME}-container" \ - usage="s2i build rhscl/${NAME}-${PERL_SHORT_VER}-rhel7:latest " - -# TODO: Cleanup cpanp cache after cpanminus is installed? -RUN yum install -y yum-utils && \ - prepare-yum-repositories rhel-server-rhscl-7-rpms && \ - INSTALL_PKGS="rh-perl520 rh-perl520-perl-devel rh-perl520-mod_perl rh-perl520-perl-CPAN" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \ - sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \ - chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ - ENV=${APP_ROOT}/etc/scl_enable \ - PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.20/README.md b/5.20/README.md deleted file mode 100644 index 0a3eadd..0000000 --- a/5.20/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Perl 5.20 container image -========================= - -**The Perl 5.20 image is deprecated.** diff --git a/5.20/cccp.yml b/5.20/cccp.yml deleted file mode 100644 index ce586b7..0000000 --- a/5.20/cccp.yml +++ /dev/null @@ -1,3 +0,0 @@ -# This is for the purpose of building this container on -# the CentOS Container Pipeline. -job-id: perl-520-centos7 diff --git a/5.20/content_sets.yml b/5.20/content_sets.yml deleted file mode 100644 index 432c091..0000000 --- a/5.20/content_sets.yml +++ /dev/null @@ -1,10 +0,0 @@ -# This is a file defining which content sets are needed to update content in -# this image. Data provided here helps determine which images are vulnerable to -# specific CVEs. Generally you should only need to update this file when: -# 1. You start depending on new product -# 2. You are preparing new product release and your content sets will change ---- -x86_64: -- rhel-7-server-rpms -- rhel-7-server-optional-rpms -- rhel-server-rhscl-7-rpms diff --git a/5.20/root/opt/app-root/etc/httpd.conf b/5.20/root/opt/app-root/etc/httpd.conf deleted file mode 100644 index e79b195..0000000 --- a/5.20/root/opt/app-root/etc/httpd.conf +++ /dev/null @@ -1,17 +0,0 @@ -LoadModule perl_module modules/mod_perl.so -DirectoryIndex index.pl - -PerlSwitches -I./extlib/lib/perl5 - - - SetHandler perl-script - PerlResponseHandler ModPerl::PerlRun - Options +ExecCGI +SymLinksIfOwnerMatch - PerlSendHeader On - - - - Require all granted - - -IncludeOptional /opt/app-root/etc/httpd.d/*.conf diff --git a/5.20/root/opt/app-root/etc/httpd.d/50-mpm.conf.template b/5.20/root/opt/app-root/etc/httpd.d/50-mpm.conf.template deleted file mode 100644 index ca18659..0000000 --- a/5.20/root/opt/app-root/etc/httpd.d/50-mpm.conf.template +++ /dev/null @@ -1,11 +0,0 @@ -# This value should mirror what is set in MinSpareServers. -StartServers ${HTTPD_START_SERVERS} -MinSpareServers ${HTTPD_START_SERVERS} -MaxSpareServers ${HTTPD_MAX_SPARE_SERVERS} -# The MaxRequestWorkers directive sets the limit on the number of -# simultaneous requests that will be served. -# The default value, when no cgroup limits are set is 256. -MaxRequestWorkers ${HTTPD_MAX_REQUEST_WORKERS} -ServerLimit ${HTTPD_MAX_REQUEST_WORKERS} -MaxConnectionsPerChild 4000 -MaxKeepAliveRequests 100 diff --git a/5.20/root/opt/app-root/etc/httpdconf.sed b/5.20/root/opt/app-root/etc/httpdconf.sed deleted file mode 100644 index 609e8ad..0000000 --- a/5.20/root/opt/app-root/etc/httpdconf.sed +++ /dev/null @@ -1,7 +0,0 @@ -s/^Listen 80/Listen 0.0.0.0:8080/ -s/^User apache/User default/ -s/^Group apache/Group root/ -s%^DocumentRoot "/opt/rh/httpd24/root/var/www/html"%DocumentRoot "/opt/app-root/src"% -s%^ Installing application source ..." -mv /tmp/src/* ./ - -if [ -d ./cfg ]; then - echo "---> Copying configuration files..." - if [ "$(ls -A ./cfg/*.conf)" ]; then - cp -v ./cfg/*.conf /opt/app-root/etc/httpd.d/ - fi -fi - -# Allow for http proxy to be specified in uppercase -if [[ -n "${HTTP_PROXY:-}" && -z "${http_proxy:-}" ]]; then - export http_proxy=$HTTP_PROXY -fi - -export CPAN_MIRROR=${CPAN_MIRROR:-""} - -MIRROR_ARGS="" - -if [ -n "$CPAN_MIRROR" ]; then - MIRROR_ARGS="--mirror $CPAN_MIRROR" -fi - -# Don't test installed Perl modules by default -if [ "${ENABLE_CPAN_TEST}" = true ]; then - export ENABLE_CPAN_TEST="" -else - export ENABLE_CPAN_TEST="--notest" -fi - -# Configure mod_perl for PSGI. -# If PSGI_FILE variable is set but empty, skip it. -# If PSGI_FILE is set and non-empty, use it. -# If PSGI_FILE does not exist, check if exactly one ./*.psgi file exists and -# use that file. -# If PSGI_URI_PATH variable has a value, use it as a location. Default is "/". -if [ ! -v PSGI_FILE ]; then - PSGI_FILE=$(find -maxdepth 1 -name '*.psgi' -type f) -fi -PSGI_FILE_NUMBER=$(printf '%s' "$PSGI_FILE" | wc -l) -if [ -n "$PSGI_FILE" -a "$PSGI_FILE_NUMBER" -eq 0 ]; then - echo "---> PSGI application found in $PSGI_FILE" - cat >> cpanfile <<"EOF" -requires 'Plack::Handler::Apache2'; -EOF - # XXX: Escape PSGI_FILE value against httpd control characters - PSGI_FILE=$(printf '%s' "$PSGI_FILE" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g') - cat > /opt/app-root/etc/httpd.d/40-psgi.conf < - SetHandler perl-script - PerlResponseHandler Plack::Handler::Apache2 - PerlSetVar psgi_app "$PSGI_FILE" - -EOF -elif [ "$PSGI_FILE_NUMBER" -gt 0 ]; then - echo "---> Multiple PSGI applications found:" - printf '%s' "$PSGI_FILE" - echo "---> Skipping PSGI autoconfiguration!" -fi - -# Installing dependencies with cpanfile -if [ -f "cpanfile" ]; then - # Install cpanm - echo "---> Installing cpanminus 1.7102 ..." - curl -sSkL https://raw.githubusercontent.com/miyagawa/cpanminus/1.7102/cpanm |\ - perl - App::cpanminus - CPANM="./perl5/bin/cpanm" - echo "---> Installing modules from cpanfile ..." - perl $CPANM $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib Module::CoreList - perl -Iextlib/lib/perl5 $CPANM $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib --installdeps . -else - echo "---> No cpanfile found, nothing to install" -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/5.20/s2i/bin/run b/5.20/s2i/bin/run deleted file mode 100755 index 677cc44..0000000 --- a/5.20/s2i/bin/run +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -set -e - -# CPAN can install scripts. They should be available from mod_perl too. -export PATH=${PATH}:/opt/app-root/src/extlib/bin -# And we have to set Perl include path too because mod_perl's PerlSwitches -# does not apply to them. -export PERL5LIB=/opt/app-root/src/extlib/lib/perl5 - -# Warning: Please note that this will pass all environment variables available within the -# container to mod_perl by means of PerlPassEnv in the env.conf file -if [ ! -f /opt/app-root/etc/httpd.d/env.conf ]; then - env | awk -F'=' '{print "PerlPassEnv "$1}' > /opt/app-root/etc/httpd.d/env.conf -fi - -# Enable automatic reloading. This can be useful for debugging an application. -PERL_APACHE2_RELOAD=${PERL_APACHE2_RELOAD:-} -if [[ "${PERL_APACHE2_RELOAD,,}" == "true" ]]; then - cat > /opt/app-root/etc/httpd.d/50-autoreload.conf < 0 ? MAX_SERVER_LIMIT : 1)) - export HTTPD_MAX_REQUEST_WORKERS=$((MAX_SERVER_LIMIT > 256 ? 256 : MAX_SERVER_LIMIT)) -fi - -export HTTPD_START_SERVERS=${HTTPD_START_SERVERS:-8} -export HTTPD_MAX_SPARE_SERVERS=$((HTTPD_START_SERVERS+10)) - -envsubst < /opt/app-root/etc/httpd.d/50-mpm.conf.template > /opt/app-root/etc/httpd.d/50-mpm.conf - -exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND diff --git a/5.20/s2i/bin/usage b/5.20/s2i/bin/usage deleted file mode 100755 index efceb33..0000000 --- a/5.20/s2i/bin/usage +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` -NAMESPACE=centos -[[ $DISTRO =~ rhel* ]] && NAMESPACE=rhscl - -cat <&1`; -if (!defined $output) { - die "No output from `ipcount' command"; -} -print $output; diff --git a/5.20/test/psgi-variables/application1.psgi b/5.20/test/psgi-variables/application1.psgi deleted file mode 100755 index 8426829..0000000 --- a/5.20/test/psgi-variables/application1.psgi +++ /dev/null @@ -1 +0,0 @@ -die "This should not be picked up."; diff --git a/5.20/test/psgi-variables/application2.psgi b/5.20/test/psgi-variables/application2.psgi deleted file mode 100755 index 1da504f..0000000 --- a/5.20/test/psgi-variables/application2.psgi +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env plackup -use Web::Paste::Simple; -Web::Paste::Simple->new->app; diff --git a/5.20/test/psgi-variables/cpanfile b/5.20/test/psgi-variables/cpanfile deleted file mode 100644 index cd37ce7..0000000 --- a/5.20/test/psgi-variables/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Web::Paste::Simple'; diff --git a/5.20/test/psgi/application.psgi b/5.20/test/psgi/application.psgi deleted file mode 100755 index 1da504f..0000000 --- a/5.20/test/psgi/application.psgi +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env plackup -use Web::Paste::Simple; -Web::Paste::Simple->new->app; diff --git a/5.20/test/psgi/cpanfile b/5.20/test/psgi/cpanfile deleted file mode 100644 index cd37ce7..0000000 --- a/5.20/test/psgi/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Web::Paste::Simple'; diff --git a/5.20/test/run b/5.20/test/run deleted file mode 100755 index 9c4749f..0000000 --- a/5.20/test/run +++ /dev/null @@ -1,333 +0,0 @@ -#!/bin/bash -# -# The 'run' performs a simple test that verifies that S2I image. -# The main focus here is to exercise the S2I scripts. -# -# IMAGE_NAME specifies a name of the candidate image used for testing. -# The image has to be available before this script is executed. -# -IMAGE_NAME=${IMAGE_NAME-centos/perl-520-centos-candidate} - -# TODO: Make command compatible for Mac users -test_dir="$(readlink -zf $(dirname "${BASH_SOURCE[0]}"))" -image_dir=$(readlink -zf ${test_dir}/..) - -source "${test_dir}/test-lib.sh" - -# TODO: This should be part of the image metadata -test_port=8080 - -info() { - echo -e "\n\e[1m[INFO] $@...\e[0m\n" -} - -image_exists() { - docker inspect $1 &>/dev/null -} - -container_exists() { - image_exists $(cat $cid_file) -} - -container_ip() { - docker inspect --format="{{ .NetworkSettings.IPAddress }}" $(cat $cid_file) -} - -run_s2i_build() { - s2i build "$@" file://${test_dir}/${test_name} ${IMAGE_NAME} ${IMAGE_NAME}-testapp -} - -prepare() { - if ! image_exists ${IMAGE_NAME}; then - echo "ERROR: The image ${IMAGE_NAME} must exist before this script is executed." - exit 1 - fi - # TODO: S2I build require the application is a valid 'GIT' repository, we - # should remove this restriction in the future when a file:// is used. - info "Build the test application image" - pushd ${test_dir}/${test_name} >/dev/null - git init - git config user.email "build@localhost" && git config user.name "builder" - git add -A && git commit -m "Sample commit" - popd >/dev/null -} - -run_test_application() { - docker run --user=100001 --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp -} - -cleanup_test_app() { - info "Cleaning up the test application" - if [ -f $cid_file ]; then - if container_exists; then - docker stop $(cat $cid_file) - docker rm $(cat $cid_file) - fi - rm $cid_file - fi -} - -cleanup() { - info "Cleaning up the test application image" - if image_exists ${IMAGE_NAME}-testapp; then - docker rmi -f ${IMAGE_NAME}-testapp - fi - rm -rf ${test_dir}/${test_name}/.git -} - -check_result() { - local result="$1" - if [[ "$result" != "0" ]]; then - info "TEST FAILED (${result})" - cleanup - exit $result - fi -} - -wait_for_cid() { - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - info "Waiting for application container to start" - while [ $attempt -le $max_attempts ]; do - [ -f $cid_file ] && [ -s $cid_file ] && break - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done -} - -test_s2i_usage() { - info "Testing 's2i usage'" - s2i usage ${s2i_args} ${IMAGE_NAME} &>/dev/null -} - -test_docker_run_usage() { - info "Testing 'docker run' usage" - docker run ${IMAGE_NAME} &>/dev/null -} - -test_scl_usage() { - local run_cmd="$1" - local expected="$2" - - info "Testing the image SCL enable" - out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}") - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/bash -c "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/sh -ic "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/sh -ic "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi -} - -# Perform GET request to the application container. -# First argument is request URI path. -# Second argument is expected HTTP response code. -# Third argument is PCRE regular expression that must match the response body. -test_response() { - local uri_path="$1" - local expected_code="$2" - local body_regexp="$3" - - local url="http://$(container_ip):${test_port}${uri_path}" - info "Testing the HTTP response for <${url}>" - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - while [ $attempt -le $max_attempts ]; do - response=$(curl -s -w '%{http_code}' "${url}") - status=$? - if [ $status -eq 0 ]; then - response_code=$(printf '%s' "$response" | tail -c 3) - response_body=$(printf '%s' "$response" | head -c -3) - if [ "$response_code" -eq "$expected_code" ]; then - result=0 - fi - printf '%s' "$response_body" | grep -qP -e "$body_regexp" || result=1; - break - fi - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done - return $result -} - -# Match PCRE regular expression against container standard output. -# First argument is the PCRE regular expression. -# It expects standard output in ${tmp_dir}/out file. -test_stdout() { - local regexp="$1" - local output="${tmp_dir}/out" - info "Testing the container standard output for /${regexp}/" - grep -qP -e "$regexp" "$output"; -} - -# Match PCRE regular expression against container standard error output. -# First argument is the PCRE regular expression. -# It expects error output in ${tmp_dir}/err file. -test_stderr() { - local regexp="$1" - local output="${tmp_dir}/err" - info "Testing the container error output for /${regexp}/" - grep -qP -e "$regexp" "$output"; -} - -test_connection() { - test_response '/' 200 '' -} - -test_application() { - # Verify that the HTTP connection can be established to test application container - run_test_application & - - # Wait for the container to write it's CID file - wait_for_cid - - test_scl_usage "perl --version" "v5.20.1" - check_result $? - - test_connection - check_result $? - cleanup_test_app -} - -# Build application, run it, perform test function, clean up. -# First argument is directory name. -# Second argument is function that expects running application. The function -# must return (or terminate with) non-zero value to report an failure, -# 0 otherwise. -# Other arguments are additional s2i options, like --env=FOO=bar. -# The test function have available container ID in $cid_file, container output -# in ${tmp_dir}/out, container stderr in ${tmp_dir}/err. -do_test() { - test_name="$1" - test_function="$2" - shift 2 - - # Old source-to-image 1.0.3 does not support multiple --env options. - # TODO: Remove ARGUMENTS conversion after dropping support 1.0.3. - local old_sti=0 - if [[ "$(LC_ALL=C s2i help build 2>&1)" =~ \ - 'Specify an environment var NAME=VALUE,NAME2=VALUE2' ]]; then - old_sti=1 - fi - local argument arguments environment - for argument in "$@"; do - if [ "$old_sti" == '1' -a "${argument:0:6}" == '--env=' ]; then - environment="${environment:+${environment},}${argument:6}" - else - arguments[${#arguments[*]}]="$argument" - fi - done - if [ -n "$environment" ]; then - arguments[${#arguments[*]}]="--env=${environment}" - fi - - info "Starting tests for ${test_name}." - - tmp_dir=$(mktemp -d) - check_result $? - cid_file="${tmp_dir}/cid" - s2i_args="--pull-policy=never" - - # Build and run the test application - prepare - run_s2i_build $s2i_args "${arguments[@]}" - check_result $? - run_test_application >"${tmp_dir}/out" 2>"${tmp_dir}/err" & - wait_for_cid - - # Perform user-supplied test function - $test_function; - check_result $? - - # Terminate the test application and clean up - cleanup_test_app - cleanup - rm -rf "$tmp_dir" - info "All tests for the ${test_name} finished successfully." -} - - -# List of tests to execute: - -# This is original test that does more things like s2i API checks. Other tests -# executed by do_test() will not repeat these checks. -test_1() { - test_name='sample-test-app' - info "Starting tests for ${test_name}" - - cid_file=$(mktemp -u --suffix=.cid) - - # Since we built the candidate image locally, we don't want S2I attempt to pull - # it from Docker hub - s2i_args="--pull-policy=never" - - prepare - run_s2i_build $s2i_args - check_result $? - - # Verify the 'usage' script is working properly when running the base image with 's2i usage ...' - test_s2i_usage - check_result $? - - # Verify the 'usage' script is working properly when running the base image with 'docker run ...' - test_docker_run_usage - check_result $? - - # Test application with default UID - test_application - - # Test application with random UID - CONTAINER_ARGS="-u 12345" test_application - - info "All tests for the ${test_name} finished successfully." - cleanup -} -test_1 - -# Check scripts installed from CPAN are available to the application. -test_2_function() { - test_response '/' 200 'Usage' -} -do_test 'binpath' 'test_2_function' - -# Check a single PSGI application is recognized a mod_perl is autoconfigured. -test_3_function() { - test_response '/' 200 'Web::Paste::Simple' -} -do_test 'psgi' 'test_3_function' - -# Check variables can select a PSGI application and set URI path. -test_4_function() { - test_response '/path' 200 '<title>Web::Paste::Simple' && \ - test_response '/cpanfile' 200 'requires' -} -do_test 'psgi-variables' 'test_4_function' \ - '--env=PSGI_FILE=./application2.psgi' '--env=PSGI_URI_PATH=/path' - -# Check httpd access_log flows to stdout, error_log to stdout. -# TODO: send error_log to stderr after dropping support for broken -# docker < 1.9. -test_5_function() { - test_response '/' 200 'Text in HTTP body' && \ - test_stdout '"GET /[^"]*" 200 ' && \ - test_stdout 'Warning on stderr' -} -do_test 'warningonstderr' 'test_5_function' - -echo "Testing npm availibility" -ct_npm_works -check_result $? - -info "All tests finished successfully." diff --git a/5.20/test/run-openshift b/5.20/test/run-openshift deleted file mode 100755 index bfc89b5..0000000 --- a/5.20/test/run-openshift +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Test the Perl image in OpenShift. -# -# IMAGE_NAME specifies a name of the candidate image used for testing. -# The image has to be available before this script is executed. -# - -THISDIR=$(dirname ${BASH_SOURCE[0]}) - -source ${THISDIR}/test-lib.sh -source ${THISDIR}/test-lib-openshift.sh - -set -exo nounset - -test -n "${IMAGE_NAME-}" || false 'make sure $IMAGE_NAME is defined' -test -n "${VERSION-}" || false 'make sure $VERSION is defined' - -ct_os_cluster_up - -# TODO: We should ideally use a local directory instead of ${VERSION}/test/sample-test-app, -# so we can test changes in that example app that are done as part of the PR -ct_os_test_s2i_app ${IMAGE_NAME} "https://github.com/sclorg/s2i-perl-container.git" ${VERSION}/test/sample-test-app "Everything is OK" - -ct_os_test_s2i_app ${IMAGE_NAME} "https://github.com/sclorg/dancer-ex.git" . 'Welcome to your Dancer application on OpenShift' - -# TODO: this was not working because the referenced example dir was added as part of this commit -ct_os_test_template_app ${IMAGE_NAME} \ - ${THISDIR}/sample-test-app.json \ - perl \ - "Everything is OK" \ - 8080 http 200 "-p SOURCE_REPOSITORY_REF=staging -p VERSION=${VERSION}" - diff --git a/5.20/test/sample-test-app b/5.20/test/sample-test-app deleted file mode 120000 index ba0a23b..0000000 --- a/5.20/test/sample-test-app +++ /dev/null @@ -1 +0,0 @@ -../../examples/sample-test-app/ \ No newline at end of file diff --git a/5.20/test/sample-test-app.json b/5.20/test/sample-test-app.json deleted file mode 120000 index 3627c79..0000000 --- a/5.20/test/sample-test-app.json +++ /dev/null @@ -1 +0,0 @@ -../../examples/templates/sample-test-app.json \ No newline at end of file diff --git a/5.20/test/test-lib-openshift.sh b/5.20/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f299..0000000 --- a/5.20/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/5.20/test/test-lib.sh b/5.20/test/test-lib.sh deleted file mode 120000 index 1ac99b9..0000000 --- a/5.20/test/test-lib.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib.sh \ No newline at end of file diff --git a/5.20/test/warningonstderr/index.pl b/5.20/test/warningonstderr/index.pl deleted file mode 100755 index 21e05a1..0000000 --- a/5.20/test/warningonstderr/index.pl +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/perl -print "Content-type: text/plain\n\n"; -warn "Warning on stderr\n"; -print "Text in HTTP body\n"; diff --git a/5.24/Dockerfile b/5.24/Dockerfile deleted file mode 100644 index 9dc777d..0000000 --- a/5.24/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -FROM centos/s2i-base-centos7 - -# This image provides a Perl 5.24 environment you can use to run your Perl applications. - -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.24 \ - PERL_SHORT_VER=524 \ - NAME=perl - -ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \ - DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \ -building and running various Perl $PERL_VERSION applications and frameworks. \ -Perl is a high-level programming language with roots in C, sed, awk and shell scripting. \ -Perl is good at handling processes and files, and is especially good at handling text. \ -Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \ -different things, Perl's most common applications are system administration utilities \ -and web programming." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Apache 2.4 with mod_perl/$PERL_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,${NAME},${NAME}${PERL_SHORT_VER}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - name="centos/${NAME}-${PERL_SHORT_VER}-centos7" \ - com.redhat.component="rh-${NAME}${PERL_SHORT_VER}-container" \ - version="$PERL_VERSION" \ - maintainer="SoftwareCollections.org <sclorg@redhat.com>" \ - help="For more information visit https://github.com/sclorg/s2i-${NAME}-container" \ - usage="s2i build <SOURCE-REPOSITORY> centos/${NAME}-${PERL_SHORT_VER}-centos7:latest <APP-NAME>" - -RUN yum install -y centos-release-scl && \ - INSTALL_PKGS="rh-perl524 rh-perl524-perl-core rh-perl524-perl-devel rh-perl524-mod_perl rh-perl524-perl-CPAN rh-perl524-perl-App-cpanminus" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \ - sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \ - chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ - ENV=${APP_ROOT}/etc/scl_enable \ - PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.24/Dockerfile.rhel7 b/5.24/Dockerfile.rhel7 deleted file mode 100644 index 42d9a61..0000000 --- a/5.24/Dockerfile.rhel7 +++ /dev/null @@ -1,67 +0,0 @@ -FROM rhscl/s2i-base-rhel7 - -# This image provides a Perl 5.24 environment you can use to run your Perl applications. - -EXPOSE 8080 - -# Image metadata -ENV PERL_VERSION=5.24 \ - PERL_SHORT_VER=524 \ - NAME=perl - -ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \ - DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \ -building and running various Perl $PERL_VERSION applications and frameworks. \ -Perl is a high-level programming language with roots in C, sed, awk and shell scripting. \ -Perl is good at handling processes and files, and is especially good at handling text. \ -Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \ -different things, Perl's most common applications are system administration utilities \ -and web programming." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Apache 2.4 with mod_perl/$PERL_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,${NAME},${NAME}${PERL_SHORT_VER}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - name="rhscl/${NAME}-${PERL_SHORT_VER}-rhel7" \ - com.redhat.component="rh-${NAME}${PERL_SHORT_VER}-container" \ - version="$PERL_VERSION" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ - maintainer="SoftwareCollections.org <sclorg@redhat.com>" \ - help="For more information visit https://github.com/sclorg/s2i-${NAME}-container" \ - usage="s2i build <SOURCE-REPOSITORY> rhscl/${NAME}-${PERL_SHORT_VER}-rhel7:latest <APP-NAME>" - -RUN yum install -y yum-utils && \ - prepare-yum-repositories rhel-server-rhscl-7-rpms && \ - INSTALL_PKGS="rh-perl524 rh-perl524-perl-core rh-perl524-perl-devel rh-perl524-mod_perl rh-perl524-perl-CPAN rh-perl524-perl-App-cpanminus" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# In order to drop the root user, we have to make some directories world -# writeable as OpenShift default security model is to run the container under -# random UID. -RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \ - sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ - chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \ - chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ - ENV=${APP_ROOT}/etc/scl_enable \ - PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/5.24/README.md b/5.24/README.md deleted file mode 100644 index eae9943..0000000 --- a/5.24/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Perl 5.24 container image -========================= - -**The Perl 5.24 image is deprecated.** \ No newline at end of file diff --git a/5.24/cccp.yml b/5.24/cccp.yml deleted file mode 100644 index 3a66e28..0000000 --- a/5.24/cccp.yml +++ /dev/null @@ -1,3 +0,0 @@ -# This is for the purpose of building this container on -# the CentOS Container Pipeline. -job-id: perl-524-centos7 diff --git a/5.24/content_sets.yml b/5.24/content_sets.yml deleted file mode 100644 index 6c39e01..0000000 --- a/5.24/content_sets.yml +++ /dev/null @@ -1,10 +0,0 @@ -# This is a file defining which content sets are needed to update content in -# this image. Data provided here helps determine which images are vulnerable to -# specific CVEs. Generally you should only need to update this file when: -# 1. You start depending on new product -# 2. You are preparing new product release and your content sets will change ---- -x86_64: -- rhel-7-server-rpms -- rhel-7-server-optional-rpms -- rhel-server-rhscl-7-rpms diff --git a/5.24/root/opt/app-root/etc/httpd.conf b/5.24/root/opt/app-root/etc/httpd.conf deleted file mode 100644 index e79b195..0000000 --- a/5.24/root/opt/app-root/etc/httpd.conf +++ /dev/null @@ -1,17 +0,0 @@ -LoadModule perl_module modules/mod_perl.so -DirectoryIndex index.pl - -PerlSwitches -I./extlib/lib/perl5 - -<Files ~ "\.(pl|cgi)$"> - SetHandler perl-script - PerlResponseHandler ModPerl::PerlRun - Options +ExecCGI +SymLinksIfOwnerMatch - PerlSendHeader On -</Files> - -<Directory "/opt/app-root/src"> - Require all granted -</Directory> - -IncludeOptional /opt/app-root/etc/httpd.d/*.conf diff --git a/5.24/root/opt/app-root/etc/httpd.d/50-mpm.conf.template b/5.24/root/opt/app-root/etc/httpd.d/50-mpm.conf.template deleted file mode 100644 index ca18659..0000000 --- a/5.24/root/opt/app-root/etc/httpd.d/50-mpm.conf.template +++ /dev/null @@ -1,11 +0,0 @@ -# This value should mirror what is set in MinSpareServers. -StartServers ${HTTPD_START_SERVERS} -MinSpareServers ${HTTPD_START_SERVERS} -MaxSpareServers ${HTTPD_MAX_SPARE_SERVERS} -# The MaxRequestWorkers directive sets the limit on the number of -# simultaneous requests that will be served. -# The default value, when no cgroup limits are set is 256. -MaxRequestWorkers ${HTTPD_MAX_REQUEST_WORKERS} -ServerLimit ${HTTPD_MAX_REQUEST_WORKERS} -MaxConnectionsPerChild 4000 -MaxKeepAliveRequests 100 diff --git a/5.24/root/opt/app-root/etc/httpdconf.sed b/5.24/root/opt/app-root/etc/httpdconf.sed deleted file mode 100644 index 609e8ad..0000000 --- a/5.24/root/opt/app-root/etc/httpdconf.sed +++ /dev/null @@ -1,7 +0,0 @@ -s/^Listen 80/Listen 0.0.0.0:8080/ -s/^User apache/User default/ -s/^Group apache/Group root/ -s%^DocumentRoot "/opt/rh/httpd24/root/var/www/html"%DocumentRoot "/opt/app-root/src"% -s%^<Directory "/opt/rh/httpd24/root/var/html"%<Directory "/opt/app-root/src"% -s%^ErrorLog "logs/error_log"%ErrorLog "|/usr/bin/cat"% -s%CustomLog "logs/access_log"%CustomLog "|/usr/bin/cat"% diff --git a/5.24/root/opt/app-root/etc/scl_enable b/5.24/root/opt/app-root/etc/scl_enable deleted file mode 100644 index f99b3a2..0000000 --- a/5.24/root/opt/app-root/etc/scl_enable +++ /dev/null @@ -1,6 +0,0 @@ -# IMPORTANT: Do not add more content to this file unless you know what you are -# doing. This file is sourced everytime the shell session is opened. -# -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable httpd24 rh-perl524 $NODEJS_SCL diff --git a/5.24/s2i/bin/assemble b/5.24/s2i/bin/assemble deleted file mode 100755 index c80f979..0000000 --- a/5.24/s2i/bin/assemble +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -set -e - -shopt -s dotglob -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ -d ./cfg ]; then - echo "---> Copying configuration files..." - if [ "$(ls -A ./cfg/*.conf)" ]; then - cp -av ./cfg/*.conf /opt/app-root/etc/httpd.d/ - fi -fi - -# Allow for http proxy to be specified in uppercase -if [[ -n "${HTTP_PROXY:-}" && -z "${http_proxy:-}" ]]; then - export http_proxy=$HTTP_PROXY -fi - -export CPAN_MIRROR=${CPAN_MIRROR:-""} - -MIRROR_ARGS="" - -if [ -n "$CPAN_MIRROR" ]; then - MIRROR_ARGS="--mirror $CPAN_MIRROR" -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Don't test installed Perl modules by default -if [ "${ENABLE_CPAN_TEST}" = true ]; then - export ENABLE_CPAN_TEST="" -else - export ENABLE_CPAN_TEST="--notest" -fi - -# Configure mod_perl for PSGI. -# If PSGI_FILE variable is set but empty, skip it. -# If PSGI_FILE is set and non-empty, use it. -# If PSGI_FILE does not exist, check if exactly one ./*.psgi file exists and -# use that file. -# If PSGI_URI_PATH variable has a value, use it as a location. Default is "/". -if [ ! -v PSGI_FILE ]; then - PSGI_FILE=$(find -maxdepth 1 -name '*.psgi' -type f) -fi -PSGI_FILE_NUMBER=$(printf '%s' "$PSGI_FILE" | wc -l) -if [ -n "$PSGI_FILE" -a "$PSGI_FILE_NUMBER" -eq 0 ]; then - echo "---> PSGI application found in $PSGI_FILE" - cat >> cpanfile <<"EOF" -requires 'Plack::Handler::Apache2'; -EOF - # XXX: Escape PSGI_FILE value against httpd control characters - PSGI_FILE=$(printf '%s' "$PSGI_FILE" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g') - cat > /opt/app-root/etc/httpd.d/40-psgi.conf <<EOF -<Location ${PSGI_URI_PATH:=/}> - SetHandler perl-script - PerlResponseHandler Plack::Handler::Apache2 - PerlSetVar psgi_app "$PSGI_FILE" -</Location> -EOF -elif [ "$PSGI_FILE_NUMBER" -gt 0 ]; then - echo "---> Multiple PSGI applications found:" - printf '%s' "$PSGI_FILE" - echo "---> Skipping PSGI autoconfiguration!" -fi - -# Installing dependencies with cpanfile -if [ -f "cpanfile" ]; then - echo "---> Installing modules from cpanfile ..." - cpanm $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib Module::CoreList - cpanm $MIRROR_ARGS $ENABLE_CPAN_TEST -l extlib --installdeps . -else - echo "---> No cpanfile found, nothing to install" -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/5.24/s2i/bin/run b/5.24/s2i/bin/run deleted file mode 100755 index 677cc44..0000000 --- a/5.24/s2i/bin/run +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -set -e - -# CPAN can install scripts. They should be available from mod_perl too. -export PATH=${PATH}:/opt/app-root/src/extlib/bin -# And we have to set Perl include path too because mod_perl's PerlSwitches -# does not apply to them. -export PERL5LIB=/opt/app-root/src/extlib/lib/perl5 - -# Warning: Please note that this will pass all environment variables available within the -# container to mod_perl by means of PerlPassEnv in the env.conf file -if [ ! -f /opt/app-root/etc/httpd.d/env.conf ]; then - env | awk -F'=' '{print "PerlPassEnv "$1}' > /opt/app-root/etc/httpd.d/env.conf -fi - -# Enable automatic reloading. This can be useful for debugging an application. -PERL_APACHE2_RELOAD=${PERL_APACHE2_RELOAD:-} -if [[ "${PERL_APACHE2_RELOAD,,}" == "true" ]]; then - cat > /opt/app-root/etc/httpd.d/50-autoreload.conf <<EOF -PerlModule Apache2::Reload -PerlInitHandler Apache2::Reload -EOF -fi - -export_vars=$(cgroup-limits) ; export $export_vars - -# Validate server limit option -if [[ ! "${HTTPD_MAX_REQUEST_WORKERS:-1}" =~ ^[1-9][0-9]*$ || "${HTTPD_MAX_REQUEST_WORKERS:-1}" -gt 20000 ]]; then - echo "HTTPD_MAX_REQUEST_WORKERS needs be an integer between 1 and 20000" - exit 1 -fi - -# If there is no server limit specified, try to guess the best value -if [ -z "${HTTPD_MAX_REQUEST_WORKERS:-}" ]; then - MAX_SERVER_LIMIT=$(((MEMORY_LIMIT_IN_BYTES/1024/1024 - 30) / 7)) - MAX_SERVER_LIMIT=$((MAX_SERVER_LIMIT > 0 ? MAX_SERVER_LIMIT : 1)) - export HTTPD_MAX_REQUEST_WORKERS=$((MAX_SERVER_LIMIT > 256 ? 256 : MAX_SERVER_LIMIT)) -fi - -export HTTPD_START_SERVERS=${HTTPD_START_SERVERS:-8} -export HTTPD_MAX_SPARE_SERVERS=$((HTTPD_START_SERVERS+10)) - -envsubst < /opt/app-root/etc/httpd.d/50-mpm.conf.template > /opt/app-root/etc/httpd.d/50-mpm.conf - -exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND diff --git a/5.24/s2i/bin/usage b/5.24/s2i/bin/usage deleted file mode 100755 index 7b61cf8..0000000 --- a/5.24/s2i/bin/usage +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` -NAMESPACE=centos -[[ $DISTRO =~ rhel* ]] && NAMESPACE=rhscl - -cat <<EOF -This is a S2I ${IMAGE_DESCRIPTION} ${DISTRO} base image: -To use it, install S2I: https://github.com/openshift/source-to-image - -Sample invocation: - -s2i build https://github.com/sclorg/s2i-perl-container.git --context-dir=5.24/test/sample-test-app/ ${NAMESPACE}/perl-524-${DISTRO}7 perl-sample-app - -You can then run the resulting image via: -docker run -p 8080:8080 perl-sample-app -EOF diff --git a/5.24/test/binpath/cpanfile b/5.24/test/binpath/cpanfile deleted file mode 100644 index 9e2a0b6..0000000 --- a/5.24/test/binpath/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Net::IP'; diff --git a/5.24/test/binpath/index.pl b/5.24/test/binpath/index.pl deleted file mode 100755 index d0b8155..0000000 --- a/5.24/test/binpath/index.pl +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/perl -print "Content-type: text/plain\n\n"; -my $output = `ipcount 2>&1`; -if (!defined $output) { - die "No output from `ipcount' command"; -} -print $output; diff --git a/5.24/test/psgi-variables/application1.psgi b/5.24/test/psgi-variables/application1.psgi deleted file mode 100755 index 8426829..0000000 --- a/5.24/test/psgi-variables/application1.psgi +++ /dev/null @@ -1 +0,0 @@ -die "This should not be picked up."; diff --git a/5.24/test/psgi-variables/application2.psgi b/5.24/test/psgi-variables/application2.psgi deleted file mode 100755 index 1da504f..0000000 --- a/5.24/test/psgi-variables/application2.psgi +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env plackup -use Web::Paste::Simple; -Web::Paste::Simple->new->app; diff --git a/5.24/test/psgi-variables/cpanfile b/5.24/test/psgi-variables/cpanfile deleted file mode 100644 index cd37ce7..0000000 --- a/5.24/test/psgi-variables/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Web::Paste::Simple'; diff --git a/5.24/test/psgi/application.psgi b/5.24/test/psgi/application.psgi deleted file mode 100755 index 1da504f..0000000 --- a/5.24/test/psgi/application.psgi +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env plackup -use Web::Paste::Simple; -Web::Paste::Simple->new->app; diff --git a/5.24/test/psgi/cpanfile b/5.24/test/psgi/cpanfile deleted file mode 100644 index cd37ce7..0000000 --- a/5.24/test/psgi/cpanfile +++ /dev/null @@ -1 +0,0 @@ -requires 'Web::Paste::Simple'; diff --git a/5.24/test/run b/5.24/test/run deleted file mode 100755 index ebe93bc..0000000 --- a/5.24/test/run +++ /dev/null @@ -1,314 +0,0 @@ -#!/bin/bash -# -# The 'run' performs a simple test that verifies that S2I image. -# The main focus here is to exercise the S2I scripts. -# -# IMAGE_NAME specifies a name of the candidate image used for testing. -# The image has to be available before this script is executed. -# -IMAGE_NAME=${IMAGE_NAME-centos/perl-524-centos-candidate} - -# TODO: Make command compatible for Mac users -test_dir="$(readlink -zf $(dirname "${BASH_SOURCE[0]}"))" -image_dir=$(readlink -zf ${test_dir}/..) - -source "${test_dir}/test-lib.sh" - -# TODO: This should be part of the image metadata -test_port=8080 - -info() { - echo -e "\n\e[1m[INFO] $@...\e[0m\n" -} - -image_exists() { - docker inspect $1 &>/dev/null -} - -container_exists() { - image_exists $(cat $cid_file) -} - -container_ip() { - docker inspect --format="{{ .NetworkSettings.IPAddress }}" $(cat $cid_file) -} - -run_s2i_build() { - ct_s2i_build_as_df file://${test_dir}/${test_name} ${IMAGE_NAME} ${IMAGE_NAME}-testapp $(ct_build_s2i_npm_variables) "$@" -} - -prepare() { - if ! image_exists ${IMAGE_NAME}; then - echo "ERROR: The image ${IMAGE_NAME} must exist before this script is executed." - exit 1 - fi - # TODO: S2I build require the application is a valid 'GIT' repository, we - # should remove this restriction in the future when a file:// is used. - info "Build the test application image" - pushd ${test_dir}/${test_name} >/dev/null - git init - git config user.email "build@localhost" && git config user.name "builder" - git add -A && git commit -m "Sample commit" - popd >/dev/null -} - -run_test_application() { - docker run --user=100001 --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp -} - -cleanup_test_app() { - info "Cleaning up the test application" - if [ -f $cid_file ]; then - if container_exists; then - docker stop $(cat $cid_file) - docker rm $(cat $cid_file) - fi - rm $cid_file - fi -} - -cleanup() { - info "Cleaning up the test application image" - if image_exists ${IMAGE_NAME}-testapp; then - docker rmi -f ${IMAGE_NAME}-testapp - fi - rm -rf ${test_dir}/${test_name}/.git -} - -check_result() { - local result="$1" - if [[ "$result" != "0" ]]; then - info "TEST FAILED (${result})" - cleanup - exit $result - fi -} - -wait_for_cid() { - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - info "Waiting for application container to start" - while [ $attempt -le $max_attempts ]; do - [ -f $cid_file ] && [ -s $cid_file ] && break - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done -} - -test_s2i_usage() { - info "Testing 's2i usage'" - ct_s2i_usage ${IMAGE_NAME} ${s2i_args} &>/dev/null -} - -test_docker_run_usage() { - info "Testing 'docker run' usage" - docker run ${IMAGE_NAME} &>/dev/null -} - -test_scl_usage() { - local run_cmd="$1" - local expected="$2" - - info "Testing the image SCL enable" - out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}") - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/bash -c "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi - out=$(docker exec $(cat ${cid_file}) /bin/sh -ic "${run_cmd}" 2>&1) - if ! echo "${out}" | grep -q "${expected}"; then - echo "ERROR[exec /bin/sh -ic "${run_cmd}"] Expected '${expected}', got '${out}'" - return 1 - fi -} - -# Perform GET request to the application container. -# First argument is request URI path. -# Second argument is expected HTTP response code. -# Third argument is PCRE regular expression that must match the response body. -test_response() { - local uri_path="$1" - local expected_code="$2" - local body_regexp="$3" - - local url="http://$(container_ip):${test_port}${uri_path}" - info "Testing the HTTP response for <${url}>" - local max_attempts=10 - local sleep_time=1 - local attempt=1 - local result=1 - while [ $attempt -le $max_attempts ]; do - response=$(curl -s -w '%{http_code}' "${url}") - status=$? - if [ $status -eq 0 ]; then - response_code=$(printf '%s' "$response" | tail -c 3) - response_body=$(printf '%s' "$response" | head -c -3) - if [ "$response_code" -eq "$expected_code" ]; then - result=0 - fi - printf '%s' "$response_body" | grep -qP -e "$body_regexp" || result=1; - break - fi - attempt=$(( $attempt + 1 )) - sleep $sleep_time - done - return $result -} - -# Match PCRE regular expression against container standard output. -# First argument is the PCRE regular expression. -# It expects standard output in ${tmp_dir}/out file. -test_stdout() { - local regexp="$1" - local output="${tmp_dir}/out" - info "Testing the container standard output for /${regexp}/" - grep -qP -e "$regexp" "$output"; -} - -# Match PCRE regular expression against container standard error output. -# First argument is the PCRE regular expression. -# It expects error output in ${tmp_dir}/err file. -test_stderr() { - local regexp="$1" - local output="${tmp_dir}/err" - info "Testing the container error output for /${regexp}/" - grep -qP -e "$regexp" "$output"; -} - -test_connection() { - test_response '/' 200 '' -} - -test_application() { - # Verify that the HTTP connection can be established to test application container - run_test_application & - - # Wait for the container to write it's CID file - wait_for_cid - - test_scl_usage "perl --version" "v5.24." - check_result $? - - test_connection - check_result $? - cleanup_test_app -} - -# Build application, run it, perform test function, clean up. -# First argument is directory name. -# Second argument is function that expects running application. The function -# must return (or terminate with) non-zero value to report an failure, -# 0 otherwise. -# Other arguments are additional s2i options, like --env=FOO=bar. -# The test function have available container ID in $cid_file, container output -# in ${tmp_dir}/out, container stderr in ${tmp_dir}/err. -do_test() { - test_name="$1" - test_function="$2" - shift 2 - - info "Starting tests for ${test_name}." - - tmp_dir=$(mktemp -d) - check_result $? - cid_file="${tmp_dir}/cid" - s2i_args="--pull-policy=never" - - # Build and run the test application - prepare - run_s2i_build $s2i_args "$@" - check_result $? - run_test_application >"${tmp_dir}/out" 2>"${tmp_dir}/err" & - wait_for_cid - - # Perform user-supplied test function - $test_function; - check_result $? - - # Terminate the test application and clean up - cleanup_test_app - cleanup - rm -rf "$tmp_dir" - info "All tests for the ${test_name} finished successfully." -} - - -# List of tests to execute: - -# This is original test that does more things like s2i API checks. Other tests -# executed by do_test() will not repeat these checks. -test_1() { - test_name='sample-test-app' - info "Starting tests for ${test_name}" - - cid_file=$(mktemp -u --suffix=.cid) - - # Since we built the candidate image locally, we don't want S2I attempt to pull - # it from Docker hub - s2i_args="--pull-policy=never" - - prepare - run_s2i_build $s2i_args - check_result $? - - # Verify the 'usage' script is working properly when running the base image with 's2i usage ...' - test_s2i_usage - check_result $? - - # Verify the 'usage' script is working properly when running the base image with 'docker run ...' - test_docker_run_usage - check_result $? - - # Test application with default UID - test_application - - # Test application with random UID - CONTAINER_ARGS="-u 12345" test_application - - info "All tests for the ${test_name} finished successfully." - cleanup -} -test_1 - -# Check scripts installed from CPAN are available to the application. -test_2_function() { - test_response '/' 200 'Usage' -} -do_test 'binpath' 'test_2_function' - -# Check a single PSGI application is recognized a mod_perl is autoconfigured. -test_3_function() { - test_response '/' 200 '<title>Web::Paste::Simple' -} -do_test 'psgi' 'test_3_function' - -# Check variables can select a PSGI application and set URI path. -test_4_function() { - test_response '/path' 200 '<title>Web::Paste::Simple' && \ - test_response '/cpanfile' 200 'requires' -} -do_test 'psgi-variables' 'test_4_function' \ - '--env=PSGI_FILE=./application2.psgi' '--env=PSGI_URI_PATH=/path' - -# Check httpd access_log flows to stdout, error_log to stdout. -# TODO: send error_log to stderr after dropping support for broken -# docker < 1.9. -test_5_function() { - test_response '/' 200 'Text in HTTP body' && \ - test_stdout '"GET /[^"]*" 200 ' && \ - test_stdout 'Warning on stderr' -} -do_test 'warningonstderr' 'test_5_function' - -echo "Testing npm availibility" -ct_npm_works -check_result $? - -info "All tests finished successfully." diff --git a/5.24/test/run-openshift b/5.24/test/run-openshift deleted file mode 100755 index 70db417..0000000 --- a/5.24/test/run-openshift +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Test the Perl image in OpenShift. -# -# IMAGE_NAME specifies a name of the candidate image used for testing. -# The image has to be available before this script is executed. -# - -THISDIR=$(dirname ${BASH_SOURCE[0]}) - -source ${THISDIR}/test-lib.sh -source ${THISDIR}/test-lib-openshift.sh - -set -exo nounset - -test -n "${IMAGE_NAME-}" || false 'make sure $IMAGE_NAME is defined' -test -n "${VERSION-}" || false 'make sure $VERSION is defined' - -ct_os_cluster_up - -# TODO: We should ideally use a local directory instead of ${VERSION}/test/sample-test-app, -# so we can test changes in that example app that are done as part of the PR -ct_os_test_s2i_app ${IMAGE_NAME} "https://github.com/sclorg/s2i-perl-container.git" ${VERSION}/test/sample-test-app "Everything is OK" - -ct_os_test_s2i_app ${IMAGE_NAME} "https://github.com/sclorg/dancer-ex.git" . 'Welcome to your Dancer application on OpenShift' - -# TODO: this was not working because the referenced example dir was added as part of this commit -ct_os_test_template_app ${IMAGE_NAME} \ - ${THISDIR}/sample-test-app.json \ - perl \ - "Everything is OK" \ - 8080 http 200 "-p SOURCE_REPOSITORY_REF=staging -p VERSION=${VERSION} -p NAME=perl-testing" - diff --git a/5.24/test/sample-test-app b/5.24/test/sample-test-app deleted file mode 120000 index ba0a23b..0000000 --- a/5.24/test/sample-test-app +++ /dev/null @@ -1 +0,0 @@ -../../examples/sample-test-app/ \ No newline at end of file diff --git a/5.24/test/sample-test-app.json b/5.24/test/sample-test-app.json deleted file mode 120000 index 3627c79..0000000 --- a/5.24/test/sample-test-app.json +++ /dev/null @@ -1 +0,0 @@ -../../examples/templates/sample-test-app.json \ No newline at end of file diff --git a/5.24/test/test-lib-openshift.sh b/5.24/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f299..0000000 --- a/5.24/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/5.24/test/test-lib.sh b/5.24/test/test-lib.sh deleted file mode 120000 index 1ac99b9..0000000 --- a/5.24/test/test-lib.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib.sh \ No newline at end of file diff --git a/5.24/test/warningonstderr/index.pl b/5.24/test/warningonstderr/index.pl deleted file mode 100755 index 21e05a1..0000000 --- a/5.24/test/warningonstderr/index.pl +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/perl -print "Content-type: text/plain\n\n"; -warn "Warning on stderr\n"; -print "Text in HTTP body\n"; diff --git a/5.26/cccp.yml b/5.26/cccp.yml deleted file mode 100644 index 1130ac2..0000000 --- a/5.26/cccp.yml +++ /dev/null @@ -1,3 +0,0 @@ -# This is for the purpose of building this container on -# the CentOS Container Pipeline. -job-id: perl-526-centos7 diff --git a/5.30/.exclude-centos7 b/5.30/.exclude-centos7 new file mode 100644 index 0000000..e69de29 diff --git a/5.30/.exclude-fedora b/5.30/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/5.30/cccp.yml b/5.30/cccp.yml deleted file mode 100644 index 8e4c78e..0000000 --- a/5.30/cccp.yml +++ /dev/null @@ -1,3 +0,0 @@ -# This is for the purpose of building this container on -# the CentOS Container Pipeline. -job-id: perl-530-centos7 diff --git a/5.32/.exclude-fedora b/5.32/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/5.34/.exclude-fedora b/5.34/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/5.36/Dockerfile.fedora b/5.36/Dockerfile.fedora index d9a9685..7a32e24 100644 --- a/5.36/Dockerfile.fedora +++ b/5.36/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM quay.io/fedora/s2i-base:37 +FROM quay.io/fedora/s2i-base:38 # This image provides a Perl 5.36 environment you can use to run your Perl applications. EXPOSE 8080