From e4631e5b8c7418e22e058f8e492930c21c3a76d1 Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Mon, 8 Jul 2024 09:16:04 -0600 Subject: [PATCH] Update Tomcat to 9.0.91 (#8040) * Get Tomcat version from .env file * Update Tomcat to 9.0.91 --- .env | 1 + .github/workflows/codeql.java.yml | 6 ++++-- .github/workflows/tr.tests.yaml | 5 +++-- CHANGELOG.md | 3 ++- dev/traffic_router/Dockerfile | 3 ++- docker-compose.yml | 5 +++++ infrastructure/cdn-in-a-box/Makefile | 5 ++--- traffic_router/build/build_rpm.sh | 8 +++----- traffic_router/build/pom.xml | 3 +-- traffic_router/connector/pom.xml | 4 ++-- traffic_router/core/pom.xml | 6 +++--- traffic_router/pom.xml | 5 +++++ traffic_router/tomcat-rpm/build_rpm.sh | 14 ++++++-------- 13 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.env b/.env index 2f8c858f5a..9f9014e842 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ ATS_VERSION=9.1.2 GO_VERSION=1.22.5 +TOMCAT_VERSION=9.0.91 diff --git a/.github/workflows/codeql.java.yml b/.github/workflows/codeql.java.yml index 514f83227c..b82f921eb0 100644 --- a/.github/workflows/codeql.java.yml +++ b/.github/workflows/codeql.java.yml @@ -39,13 +39,15 @@ jobs: STARTUP_SCRIPT_LOC: ../core/src/main/lib/systemd/system LOGROTATE_SCRIPT_DIR: /etc/logrotate.d LOGROTATE_SCRIPT_LOC: ../core/src/main/lib/logrotate - TOMCAT_RELEASE: tomcat_release - TOMCAT_VERSION: tomcat_version + #TOMCAT_VERSION: (set from .env) steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Load environment + run: cp .env '${{ github.env }}' + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/tr.tests.yaml b/.github/workflows/tr.tests.yaml index dc0b08489d..a92b0d59ba 100644 --- a/.github/workflows/tr.tests.yaml +++ b/.github/workflows/tr.tests.yaml @@ -26,8 +26,7 @@ env: STARTUP_SCRIPT_LOC: ../core/src/main/lib/systemd/system LOGROTATE_SCRIPT_DIR: /etc/logrotate.d LOGROTATE_SCRIPT_LOC: ../core/src/main/lib/logrotate - TOMCAT_RELEASE: tomcat_release - TOMCAT_VERSION: tomcat_version + #TOMCAT_VERSION: (set from .env) on: push: @@ -47,6 +46,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@master + - name: Load environment # This loads TOMCAT_VERSION into the environment. + run: cp .env '${{ github.env }}' - name: Install Java dependencies run: sudo apt -y install libtcnative-1 maven - name: Cache local Maven repository diff --git a/CHANGELOG.md b/CHANGELOG.md index be7d1090ea..a698c6483d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Updated Go version to 1.22.0 - [#7979](https://github.com/apache/trafficcontrol/pull/7979) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Store logs in /var/log - [#7999](https://github.com/apache/trafficcontrol/pull/7999) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Symlink from /opt//var/log to /var/log/. These symlinks are deprecated with the intent of removing them in ATC 9.0.0. -- [#7872](https://github.com/apache/trafficcontrol/issues/7872) *Traffic Router*: Updated Apache Tomcat from 9.0.43, 9.0.67, 9.0.83, and 9.0.86 to 9.0.87. +- [#7990](https://github.com/apache/trafficcontrol/pull/7990) *Traffic Router*: Updated Apache Tomcat from 9.0.43, 9.0.67, 9.0.83, and 9.0.86 to 9.0.87. - [#7933](https://github.com/apache/trafficcontrol/pull/7933), [#8005](https://github.com/apache/trafficcontrol/pull/8005) *Traffic Portal v2*: Update NodeJS version to 18. - [#8009](https://github.com/apache/trafficcontrol/pull/8009) *Traffic Portal v2*: Update NodeJS version to 20. +- [#8040](https://github.com/apache/trafficcontrol/pull/8040) *Traffic Router*: Get the Tomcat version from .env and update Tomcat to 9.0.90. ### Fixed - [#8008](https://github.com/apache/trafficcontrol/pull/8008) *Traffic Router* Fix czf temp file deletion issue. diff --git a/dev/traffic_router/Dockerfile b/dev/traffic_router/Dockerfile index 51c88bd1d9..b92dc38430 100644 --- a/dev/traffic_router/Dockerfile +++ b/dev/traffic_router/Dockerfile @@ -12,6 +12,7 @@ # limitations under the License. # FROM alpine:latest AS trafficrouter-dev +ARG TOMCAT_VERSION ENV TC=/go/src/github.com/apache/trafficcontrol VOLUME "$TC" @@ -30,7 +31,7 @@ EXPOSE 3053:53/tcp \ RUN apk add --no-cache openjdk11 inotify-tools maven tomcat-native openssl && ln -s /usr/lib/jvm/java-11-openjdk/bin/jdb /bin/jdb -ADD https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.67/bin/apache-tomcat-9.0.67.tar.gz /opt/tomcat.tgz +ADD https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz /opt/tomcat.tgz RUN cd /opt && \ tar -xf tomcat.tgz && \ diff --git a/docker-compose.yml b/docker-compose.yml index d9da0325cc..c1ac713f70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -124,6 +124,11 @@ services: trafficrouter: build: context: dev/traffic_router + args: + - TOMCAT_VERSION=${TOMCAT_VERSION} + + env_file: # makes TOMCAT_VERSION avaiable to the container + - .env depends_on: - trafficmonitor hostname: trafficrouter diff --git a/infrastructure/cdn-in-a-box/Makefile b/infrastructure/cdn-in-a-box/Makefile index dad40ab16d..0a4e5ee7eb 100644 --- a/infrastructure/cdn-in-a-box/Makefile +++ b/infrastructure/cdn-in-a-box/Makefile @@ -57,8 +57,7 @@ BUILD_NUMBER := $(shell bash -c ' \ cat $(TC_DIR)/BUILD_NUMBER) BUILD_ARCH := $(shell docker run --name=ciab-get-$(BASE_IMAGE)-$(RHEL_VERSION)-arch --rm $(BASE_IMAGE):$(RHEL_VERSION) rpm --eval %_arch ) TC_VERSION := $(shell cat "$(TC_DIR)/VERSION") -TOMCAT_VERSION := $(shell grep '^\s*TOMCAT_VERSION=' "$(TC_DIR)/traffic_router/build/build_rpm.sh" | cut -d= -f2) -TOMCAT_RELEASE := $(shell grep '^\s*TOMCAT_RELEASE=' "$(TC_DIR)/traffic_router/build/build_rpm.sh" | cut -d= -f2) +TOMCAT_VERSION := $(shell grep '^\s*TOMCAT_VERSION=' "$(TC_DIR)/.env" | cut -d= -f2) ATS_VERSION := $(shell $(CIAB_DIR_RELATIVE)bin/ats-version.sh) ifeq ($(RHEL_VERSION),7) # The commit hash in `git describe` is only 7 characters in CentOS 7's git 1.8 @@ -67,7 +66,7 @@ endif SPECIAL_SAUCE := $(TC_VERSION)-$(BUILD_NUMBER).el$(RHEL_VERSION).$(BUILD_ARCH).rpm SPECIAL_SAUCE_NOARCH := $(TC_VERSION)-$(BUILD_NUMBER).el$(RHEL_VERSION).noarch.rpm -SPECIAL_SEASONING := $(TOMCAT_VERSION).$(TOMCAT_RELEASE)-1.el$(RHEL_VERSION).noarch.rpm +SPECIAL_SEASONING := $(TOMCAT_VERSION)-1.el$(RHEL_VERSION).noarch.rpm SPECIAL_SYRUP := $(ATS_VERSION).el$(RHEL_VERSION).$(BUILD_ARCH).rpm ATS_SOURCE := $(wildcard $(TC_DIR)/cache-config/testing/docker/trafficserver/**) diff --git a/traffic_router/build/build_rpm.sh b/traffic_router/build/build_rpm.sh index 1c86bce6c9..11b64f760e 100755 --- a/traffic_router/build/build_rpm.sh +++ b/traffic_router/build/build_rpm.sh @@ -73,7 +73,7 @@ buildRpmTrafficRouter () { adaptEnvironment() { echo "Verifying the build configuration environment." # get traffic_control src path -- relative to build_rpm.sh script - PACKAGE='' TC_VERSION='' RPMBUILD='' DIST='' RPM='' TOMCAT_VERSION='' TOMCAT_RELEASE='' + PACKAGE='' TC_VERSION='' RPMBUILD='' DIST='' RPM='' PACKAGE="traffic_router" TC_VERSION=$(getVersion "$TC_DIR") BUILD_NUMBER=${BUILD_NUMBER:-$(getBuildNumber)} @@ -82,15 +82,13 @@ adaptEnvironment() { DIST="$WORKSPACE/dist" RPM="${PACKAGE}-${TC_VERSION}-${BUILD_NUMBER}.noarch.rpm" RPM_TARGET_OS="${RPM_TARGET_OS:-linux}" - TOMCAT_VERSION=9.0 - TOMCAT_RELEASE=87 - export PACKAGE TC_VERSION BUILD_NUMBER WORKSPACE RPMBUILD DIST RPM RPM_TARGET_OS TOMCAT_VERSION TOMCAT_RELEASE + source "${TC_DIR}/.env" # contains TOMCAT_VERSION + export PACKAGE TC_VERSION BUILD_NUMBER WORKSPACE RPMBUILD DIST RPM RPM_TARGET_OS TOMCAT_VERSION echo "==================================================" echo "WORKSPACE: $WORKSPACE" echo "BUILD_NUMBER: $BUILD_NUMBER" echo "TOMCAT_VERSION=$TOMCAT_VERSION" - echo "TOMCAT_RELEASE=$TOMCAT_RELEASE" echo "TC_VERSION: $TC_VERSION" echo "RPM: $RPM" echo "--------------------------------------------------" diff --git a/traffic_router/build/pom.xml b/traffic_router/build/pom.xml index 6a94ef7e9a..5d14e221c0 100644 --- a/traffic_router/build/pom.xml +++ b/traffic_router/build/pom.xml @@ -89,7 +89,6 @@ BUILD_NUMBER TOMCAT_VERSION - TOMCAT_RELEASE RHEL_VERSION RPM_TARGET_OS STARTUP_SCRIPT_DIR @@ -271,7 +270,7 @@ java-11-openjdk-headless tzdata-java - tomcat >= ${env.TOMCAT_VERSION}.${env.TOMCAT_RELEASE} + tomcat >= ${tomcat.version} apr >= 1.4.8 tomcat-native >= 1.2.23 diff --git a/traffic_router/connector/pom.xml b/traffic_router/connector/pom.xml index fc2de034fd..4890018fa4 100644 --- a/traffic_router/connector/pom.xml +++ b/traffic_router/connector/pom.xml @@ -85,13 +85,13 @@ org.apache.tomcat tomcat-coyote - 9.0.87 + ${tomcat.version} provided org.apache.tomcat tomcat-catalina - 9.0.87 + ${tomcat.version} provided diff --git a/traffic_router/core/pom.xml b/traffic_router/core/pom.xml index 0dc18f0c5d..9f3afb9ffd 100644 --- a/traffic_router/core/pom.xml +++ b/traffic_router/core/pom.xml @@ -359,19 +359,19 @@ org.apache.tomcat tomcat-catalina - 9.0.87 + ${tomcat.version} provided org.apache.tomcat tomcat-coyote - 9.0.87 + ${tomcat.version} provided org.apache.tomcat tomcat-jni - 9.0.87 + ${tomcat.version} provided diff --git a/traffic_router/pom.xml b/traffic_router/pom.xml index f044823518..d809be0fe7 100644 --- a/traffic_router/pom.xml +++ b/traffic_router/pom.xml @@ -42,6 +42,11 @@ 1.9 UTF-8 11 + + ${env.TOMCAT_VERSION} diff --git a/traffic_router/tomcat-rpm/build_rpm.sh b/traffic_router/tomcat-rpm/build_rpm.sh index e79c93e397..b1b9d74872 100755 --- a/traffic_router/tomcat-rpm/build_rpm.sh +++ b/traffic_router/tomcat-rpm/build_rpm.sh @@ -41,13 +41,12 @@ checkEnvironment() { export DIST="$WORKSPACE/dist" # Forcing BUILD NUMBER to 1 since this is outside the tree and related to Tomcat Release export BUILD_NUMBER=1 - export RPM="${PACKAGE}-${TOMCAT_VERSION}.${TOMCAT_RELEASE}-${BUILD_NUMBER}.${RHEL_VERSION}.noarch.rpm" - export SRPM="${PACKAGE}-${TOMCAT_VERSION}.${TOMCAT_RELEASE}-${BUILD_NUMBER}.${RHEL_VERSION}.src.rpm" + export RPM="${PACKAGE}-${TOMCAT_VERSION}-${BUILD_NUMBER}.${RHEL_VERSION}.noarch.rpm" + export SRPM="${PACKAGE}-${TOMCAT_VERSION}-${BUILD_NUMBER}.${RHEL_VERSION}.src.rpm" echo "==================================================" echo "WORKSPACE: $WORKSPACE" - echo "TOMCAT_RELEASE: $TOMCAT_RELEASE" #defined in traffic_router echo "TOMCAT_VERSION: $TOMCAT_VERSION" #defined in traffic_router echo "BUILD_NUMBER: $BUILD_NUMBER" #defined in traffic_router echo "RPM: $RPM" @@ -61,11 +60,10 @@ initBuildArea() { cd "$RPMBUILD" mkdir -p SPECS SOURCES RPMS SRPMS BUILD BUILDROOT) || { echo "Could not create $RPMBUILD: $?"; return 1; } export VERSION=$TOMCAT_VERSION - export RELEASE=$TOMCAT_RELEASE - echo "Downloading Tomcat $VERSION.$RELEASE..." - curl -fo "${RPMBUILD}/SOURCES/apache-tomcat-${VERSION}.${RELEASE}.tar.gz" "https://archive.apache.org/dist/tomcat/tomcat-${VERSION%.*}/v${VERSION}.${RELEASE}/bin/apache-tomcat-${VERSION}.${RELEASE}.tar.gz" || \ - { echo "Could not download Tomcat $VERSION.$RELEASE: $?"; exit 1; } + echo "Downloading Tomcat $VERSION..." + curl -fo "${RPMBUILD}/SOURCES/apache-tomcat-${VERSION}.tar.gz" "https://archive.apache.org/dist/tomcat/tomcat-${VERSION%%.*}/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz" || \ + { echo "Could not download Tomcat $VERSION: $?"; exit 1; } cp "$TR_DIR/tomcat-rpm/tomcat.service" "$RPMBUILD/SOURCES/" || { echo "Could not copy source files: $?"; exit 1; } cp "$TR_DIR/tomcat-rpm/tomcat.spec" "$RPMBUILD/SPECS/" || { echo "Could not copy spec files: $?"; exit 1; } @@ -93,7 +91,7 @@ buildRpmForEl () { # build RPM with xz level 2 compression rpmbuild --define "_topdir $(pwd)" \ --define "build_number $BUILD_NUMBER.$RHEL_VERSION" \ - --define "tomcat_version $TOMCAT_VERSION.$TOMCAT_RELEASE" \ + --define "tomcat_version $TOMCAT_VERSION" \ --define "_target_os ${RPM_TARGET_OS}" \ --define '%_source_payload w2.xzdio' \ --define '%_binary_payload w2.xzdio' \