You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2022/03/15 17:23:15 UTC

[trafficcontrol] branch 6.1.x updated: Fixes the cache-config integration tests. (#6530)

This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a commit to branch 6.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/6.1.x by this push:
     new 7286b7e  Fixes the cache-config integration tests. (#6530)
7286b7e is described below

commit 7286b7eaf0c2eac5925b967daed8ce92584b8423
Author: John J. Rushford <jr...@apache.org>
AuthorDate: Tue Feb 1 15:10:09 2022 -0700

    Fixes the cache-config integration tests. (#6530)
    
    CentOS 8 docker images used in the cache-config integration
    tests no-longer build as the CentOS 8 repositories have been
    taken down.  This PR fixes the issue by swithing the CentOS 8
    images to Rocky Linux images that are compatable with RHEL 8.
    
    (cherry picked from commit f5de844341f8af08f7b63c7ea6549d82c4b6ba80)
---
 .../testing/docker/docker-compose-ats-build.yml    | 14 ++++--------
 cache-config/testing/docker/docker-compose.yml     |  6 +++++-
 cache-config/testing/docker/ort_test/Dockerfile    | 13 +++++++----
 cache-config/testing/docker/traffic_ops/Dockerfile | 20 ++++++++++-------
 .../testing/docker/trafficserver/Dockerfile        | 25 ++++++++++++----------
 cache-config/testing/docker/trafficserver/run.sh   | 14 ++++++------
 .../docker/trafficserver/trafficserver.spec        |  6 +++---
 cache-config/testing/docker/variables.env          | 14 ++++++++++++
 8 files changed, 69 insertions(+), 43 deletions(-)

diff --git a/cache-config/testing/docker/docker-compose-ats-build.yml b/cache-config/testing/docker/docker-compose-ats-build.yml
index d6331d8..ca91def 100644
--- a/cache-config/testing/docker/docker-compose-ats-build.yml
+++ b/cache-config/testing/docker/docker-compose-ats-build.yml
@@ -26,19 +26,13 @@ volumes:
 services:
 
   trafficserver_build:
-    environment:
-      - ATS_VERSION=8.1.x
-      - CJOSE_URL=https://github.com/cisco/cjose
-      - CJOSE_TAG=latest
-      - JANSSON_URL=https://github.com/akheron/jansson
-      - JANSSON_TAG=v2.11
-      - OPENSSL_URL=https://github.com/openssl/openssl
-      - OPENSSL_TAG=OpenSSL_1_1_1
-      - RUN_ATS_UNIT_TESTS=false
+    env_file:
+      - variables.env
     build:
       context: ../../..
       dockerfile: cache-config/testing/docker/trafficserver/Dockerfile
       args:
-        RHEL_VERSION: ${RHEL_VERSION:-8}
+        - OS_VERSION=${OS_VERSION:-8}
+        - OS_DISTRO=${OS_DISTRO:-rockylinux}
     volumes:
       - ../../..:/trafficcontrol:z
diff --git a/cache-config/testing/docker/docker-compose.yml b/cache-config/testing/docker/docker-compose.yml
index a4b45bd..1996c47 100644
--- a/cache-config/testing/docker/docker-compose.yml
+++ b/cache-config/testing/docker/docker-compose.yml
@@ -57,6 +57,9 @@ services:
     ports: 
       - "443:443"
     build:
+      args:
+        - OS_DISTRO=${OS_DISTRO:-rockylinux}
+        - OS_VERSION=${OS_VERSION:-8}
       context: ../../..
       dockerfile: cache-config/testing/docker/traffic_ops/Dockerfile
     volumes:
@@ -82,7 +85,8 @@ services:
       - variables.env
     build:
       args:
-        RHEL_VERSION: ${RHEL_VERSION:-8}
+        - OS_DISTRO=${OS_DISTRO:-rockylinux}
+        - OS_VERSION=${OS_VERSION:-8}
       context: .
       dockerfile: ort_test/Dockerfile
     cap_add: ['SYS_ADMIN'] # necessary for hostname tests
diff --git a/cache-config/testing/docker/ort_test/Dockerfile b/cache-config/testing/docker/ort_test/Dockerfile
index c119358..8c3fc75 100644
--- a/cache-config/testing/docker/ort_test/Dockerfile
+++ b/cache-config/testing/docker/ort_test/Dockerfile
@@ -23,14 +23,19 @@
 # The recommended minimum size for each block devices is 1G.
 # For example, `sudo modprobe brd rd_size=1048576 rd_nr=2`
 
-ARG RHEL_VERSION=8
-FROM centos:${RHEL_VERSION}
-ARG RHEL_VERSION=8
+ARG OS_VERSION=8
+ARG OS_DISTRO=rockylinux
+FROM ${OS_DISTRO}:${OS_VERSION}
+ARG OS_VERSION
+ARG OS_DISTRO
 # Makes RHEL_VERSION available in later layers without needing to specify it again
-ENV RHEL_VERSION=$RHEL_VERSION
+ENV OS_VERSION=${OS_VERSION}
+ENV OS_DISTRO=${OS_DISTRO}
 MAINTAINER dev@trafficcontrol.apache.org
 EXPOSE 80 443
 
+RUN echo "Image Version: ${OS_DISTRO}:${OS_VERSION}"
+
 RUN yum install -y epel-release && yum repolist && \
   yum install -y initscripts git jq gcc lua && \
   yum clean all
diff --git a/cache-config/testing/docker/traffic_ops/Dockerfile b/cache-config/testing/docker/traffic_ops/Dockerfile
index 2ea82aa..42de436 100644
--- a/cache-config/testing/docker/traffic_ops/Dockerfile
+++ b/cache-config/testing/docker/traffic_ops/Dockerfile
@@ -20,19 +20,23 @@
 # Based on CentOS 8
 ############################################################
 
-ARG RHEL_VERSION=8
-FROM centos:${RHEL_VERSION}
-ARG RHEL_VERSION=8
-# Makes RHEL_VERSION available in later layers without needing to specify it again
-ENV RHEL_VERSION=$RHEL_VERSION
+ARG OS_VERSION=8
+ARG OS_DISTRO=rockylinux
+FROM ${OS_DISTRO}:${OS_VERSION}
+ARG OS_VERSION
+ARG OS_DISTRO
+ENV OS_VERSION=${OS_VERSION}
+ENV OS_DISTRO=${OS_DISTRO}
 
-RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \
+RUN echo "Image Version: ${OS_DISTRO}:${OS_VERSION}"
+
+RUN if [[ "${OS_VERSION%%.*}" -eq 7 ]]; then \
 		yum -y install dnf || exit 1; \
 	fi
 
 RUN set -o nounset -o errexit && \
 	mkdir -p /etc/cron.d; \
-	if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \
+	if [[ "${OS_VERSION%%.*}" -eq 7 ]]; then \
 		use_repo=''; \
 		enable_repo=''; \
 		# needed for llvm-toolset-7-clang, which is needed for postgresql13-devel-13.2-1PGDG, required by TO rpm
@@ -41,7 +45,7 @@ RUN set -o nounset -o errexit && \
 		use_repo='--repo=pgdg13'; \
 		enable_repo='--enablerepo=powertools'; \
 	fi; \
-	dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${RHEL_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \
+	dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${OS_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \
 	# libicu required by postgresql13
 	dnf -y install libicu; \
 	dnf -y $use_repo -- install postgresql13; \
diff --git a/cache-config/testing/docker/trafficserver/Dockerfile b/cache-config/testing/docker/trafficserver/Dockerfile
index e0e7805..755d47d 100644
--- a/cache-config/testing/docker/trafficserver/Dockerfile
+++ b/cache-config/testing/docker/trafficserver/Dockerfile
@@ -19,31 +19,34 @@
 # Dockerfile to build Traffic Server RPM
 ###############################################################
 
-ARG RHEL_VERSION=8
-FROM centos:${RHEL_VERSION}
-ARG RHEL_VERSION=8
+ARG OS_VERSION=8
+ARG OS_DISTRO=rockylinux
+FROM ${OS_DISTRO}:${OS_VERSION}
+ARG OS_VERSION
+ARG OS_DISTRO
 # Makes RHEL_VERSION available in later layers without needing to specify it again
-ENV RHEL_VERSION=$RHEL_VERSION
+ENV OS_VERSION=${OS_VERSION}
+ENV OS_DISTRO=${OS_DISTRO}
 
 MAINTAINER dev@trafficcontrol.apache.org
 
 VOLUME /atsbuild
 
-RUN echo "Image Version: ${RHEL_VERSION}"
+RUN echo "Image Version: ${OS_DISTRO}:${OS_DISTRO}"
 
 ### Common for all sub-component builds
 RUN set -o errexit; \
-    if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \
-		rpm_gpg_key=RPM-GPG-KEY-centosofficial; \
+    if [[ ${OS_VERSION%%.*} -ge 8 ]]; then \
+		rpm_gpg_key=RPM-GPG-KEY-rockyofficial; \
 		yum install -y 'dnf-command(config-manager)'; \
 		yum config-manager --set-enabled powertools; \
 	else \
-		rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \
+		rpm_gpg_key="RPM-GPG-KEY-CentOS-${OS_VERSION%%.*}"; \
 		yum install -y deltarpm centos-release-scl-rh; \
 		yum-config-manager --enable rhel-server-rhscl-7-rpms; \
 	fi && \
-	rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \
-	rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \
+#	rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \
+	rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${OS_VERSION%%.*}" && \
 	yum -y clean all && \
 	yum -y update ca-certificates && \
 	yum -y install \
@@ -53,7 +56,7 @@ RUN set -o errexit; \
 		epel-release && \
 	yum -y clean all
 
-RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \
+RUN if [[ ${OS_VERSION%%.*} -ge 8 ]]; then \
 		os_pkgs=( \
 			brotli \
 			brotli-devel \
diff --git a/cache-config/testing/docker/trafficserver/run.sh b/cache-config/testing/docker/trafficserver/run.sh
index cbefad0..18e6eec 100755
--- a/cache-config/testing/docker/trafficserver/run.sh
+++ b/cache-config/testing/docker/trafficserver/run.sh
@@ -22,17 +22,19 @@ function die() {
   { test -n "$@" && echo "$@"; exit 1; } >&2 
 }
 
-RHEL_VERSION="${RHEL_VERSION}"
+OS_VERSION="${OS_VERSION}"
+OS_DISTRO=${OS_DISTRO}
 ATS_VERSION="${ATS_VERSION}"
 
-echo "RHEL_VERSION:${RHEL_VERSION}"
+echo "OS_DISTRO:${OS_DISTRO}"
+echo "OS_VERSION:${OS_VERSION}"
 echo "ATS_VERSION:${ATS_VERSION}"
 
 mkdir -p /opt/build
 cd /opt/build
 
-# build openssl 1.1.1 if RHEL_VERSION is not 8 or greater.
-if [[ ${RHEL_VERSION%%.*} -le 7 ]]; then
+# build openssl 1.1.1 if OS_VERSION is not 8 or greater.
+if [ ${OS_VERSION%%.*} -le 7 ]; then
   git clone $OPENSSL_URL --branch $OPENSSL_TAG || die "Failed to fetch the OpenSSL Source."
   (
     cd /opt/build/openssl && 
@@ -68,13 +70,13 @@ cd /root
 [ ! -e rpmbuild ] || { echo "Failed to clean up rpm build directory 'rpmbuild': $?" >&2; exit 1; }
 mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SPECS,SOURCES,SRPMS} || die "Failed to initialize the build environment"
 
-echo "Building a RPM for ATS version: $ATS_VERSION"
+echo "Building a RPM for ATS version: $ATS_VERSION and OS version: $OS_VERSION"
 
 # add the 'ats' user
 id ats &>/dev/null || /usr/sbin/useradd -u 176 -r ats -s /sbin/nologin -d /
 
 # setup the environment to use the devtoolset-9 tools.
-if [[ "${RHEL_VERSION%%.*}" -le 7 ]]; then 
+if [ "${OS_VERSION%%.*}" -le 7 ]; then 
   source scl_source enable devtoolset-9
 else
   source scl_source enable gcc-toolset-9
diff --git a/cache-config/testing/docker/trafficserver/trafficserver.spec b/cache-config/testing/docker/trafficserver/trafficserver.spec
index b793d18..12a0b72 100644
--- a/cache-config/testing/docker/trafficserver/trafficserver.spec
+++ b/cache-config/testing/docker/trafficserver/trafficserver.spec
@@ -20,9 +20,9 @@
 
 %global src %{_topdir}/SOURCES/trafficserver
 %global git_args --git-dir="%{src}/.git" --work-tree="%{src}"
-%global tag %(git %{git_args} describe --long '--exclude=*.*.*-rc*' |      sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\1/' | sed 's/-/_/')
-%global distance %(git %{git_args} describe --long '--exclude=*.*.*-rc*' | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\2/')
-%global commit %(git %{git_args} describe --long '--exclude=*.*.*-rc*' |   sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\3/')
+%global tag %(git %{git_args} describe --long |      sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\1/' | sed 's/-/_/')
+%global distance %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\2/')
+%global commit %(git %{git_args} describe --long |   sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\3/')
 %global git_serial %(git %{git_args} rev-list HEAD | wc -l)
 %global install_prefix "/opt"
 %global api_stats "4096"
diff --git a/cache-config/testing/docker/variables.env b/cache-config/testing/docker/variables.env
index ab0d591..7493fb8 100644
--- a/cache-config/testing/docker/variables.env
+++ b/cache-config/testing/docker/variables.env
@@ -15,6 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+# OS_DISTRO may be set to "centos", default is "rockylinux" since RHEL 8
+OS_DISTRO=rockylinux
+# RHEL_VERSION is 7 or 8
+OS_VERSION=8
 CDNCONF=/opt/traffic_ops/app/conf/cdn.conf
 CERT_COUNTRY=US
 CERT_STATE=Colorado
@@ -53,3 +57,13 @@ TV_HTTPS_PORT=8088
 TV_RIAK_USER=riakuser
 TV_RIAK_PASSWORD=tvsecret
 TV_DOMAIN=local
+# trafficserver build variables
+ATS_VERSION=8.1.x
+CJOSE_URL=https://github.com/cisco/cjose
+CJOSE_TAG=latest
+JANSSON_URL=https://github.com/akheron/jansson
+JANSSON_TAG=v2.11
+OPENSSL_URL=https://github.com/openssl/openssl
+OPENSSL_TAG=OpenSSL_1_1_1
+RUN_ATS_UNIT_TESTS=false
+