diff --git a/.github/workflows/ciab.yaml b/.github/workflows/ciab.yaml index aab60b3cf2..0edb483e05 100644 --- a/.github/workflows/ciab.yaml +++ b/.github/workflows/ciab.yaml @@ -212,18 +212,18 @@ jobs: path: ${{ github.workspace }}/dist/ - name: Cache Perl modules env: - CENTOS_VERSION: 8 + RHEL_VERSION: 8 uses: actions/cache@v2 with: path: ${{ github.workspace }}/infrastructure/cdn-in-a-box/traffic_ops/local - key: ${{ runner.os }}-cpan-centos-${{ env.CENTOS_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}-${{ hashFiles('**/perllocal.pod') }} + key: ${{ runner.os }}-cpan-centos-${{ env.RHEL_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}-${{ hashFiles('**/perllocal.pod') }} restore-keys: | - ${{ runner.os }}-cpan-centos-${{ env.CENTOS_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}-${{ hashFiles('**/perllocal.pod') }} - ${{ runner.os }}-cpan-centos-${{ env.CENTOS_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}- - ${{ runner.os }}-cpan-centos-${{ env.CENTOS_VERSION }}- + ${{ runner.os }}-cpan-centos-${{ env.RHEL_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}-${{ hashFiles('**/perllocal.pod') }} + ${{ runner.os }}-cpan-centos-${{ env.RHEL_VERSION }}-${{ hashFiles('cache/**.tar.gz') }}- + ${{ runner.os }}-cpan-centos-${{ env.RHEL_VERSION }}- - name: Build CDN-in-a-Box images env: - CENTOS_VERSION: 8 + RHEL_VERSION: 8 uses: ./.github/actions/build-ciab - name: Start CDN-in-a-Box uses: ./.github/actions/run-ciab diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d25492339..3c7d6bc1e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added locationByDeepCoverageZone to the `crs/stats/ip/{ip}` endpoint in the Traffic Router API - Traffic Portal: upgraded change log UI table to use more powerful/performant ag-grid component - Traffic Portal: change log days are now configurable in traffic_portal_properties.json (default is 7 days) and can be overridden by the user in TP - +- [#5319](https://github.com/apache/trafficcontrol/issues/5319) - Added support for building RPMs that target CentOS 8 ### Fixed - [#5274](https://github.com/apache/trafficcontrol/issues/5274) - CDN in a Box's Traffic Vault image failed to build due @@ -22,10 +22,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#5191](https://github.com/apache/trafficcontrol/issues/5191) - Error from IMS requests to /federations/all ### Changed -- Updated CDN in a Box to CentOS 8 and added `CENTOS_VERSION` Docker build arg so CDN in a Box can be built for CentOS 7, if desired +- Updated CDN in a Box to CentOS 8 and added `RHEL_VERSION` Docker build arg so CDN in a Box can be built for CentOS 7, if desired - Traffic Ops: removed change log entry created during server update/revalidation unqueue - ## [5.0.0] - 2020-10-20 ### Added - Traffic Ops Ort: Disabled ntpd verification (ntpd is deprecated in CentOS) diff --git a/build/functions.sh b/build/functions.sh index 7c6bde1e71..cf0adbabb1 100755 --- a/build/functions.sh +++ b/build/functions.sh @@ -124,11 +124,17 @@ getVersion() { # --------------------------------------- getRhelVersion() { - local releasever + local releasever=${RHEL_VERSION:-} + if [ -n "$releasever" ]; then + echo "el${releasever}" + return + fi + local redhat_release=/etc/redhat-release local default_version=7 if [ -e $redhat_release ]; then releasever="$(rpm -q --qf '%{version}' -f $redhat_release)" + releasever="${releasever%%.*}" else echo "${redhat_release} not found, defaulting to major release ${default_version}" >/dev/stderr releasever=${default_version} @@ -176,7 +182,7 @@ checkEnvironment() { return 1 fi - TC_VERSION='' BUILD_NUMBER='' RHEL_VERSION='' RPMBUILD='' DIST='' + TC_VERSION='' BUILD_NUMBER='' RPMBUILD='' DIST='' TC_VERSION="$(getVersion "$TC_DIR")" BUILD_NUMBER="$(getBuildNumber)" GO_VERSION="$(getGoVersion "$TC_DIR")" diff --git a/docs/source/admin/quick_howto/ciab.rst b/docs/source/admin/quick_howto/ciab.rst index 6a100d26b8..7a474ce1c6 100644 --- a/docs/source/admin/quick_howto/ciab.rst +++ b/docs/source/admin/quick_howto/ciab.rst @@ -44,12 +44,14 @@ These can all be supplied manually via the steps in :ref:`dev-building` (for Tra .. tip:: When updating CDN-in-a-Box, there is no need to remove old images before building new ones. Docker detects which files are updated and only reuses cached layers that have not changed. -By default, CDN in a Box will be based on CentOS 8. To base CDN in a Box on CentOS 7, set the ``CENTOS_VERSION`` `build arg `_ to ``7`` (it defaults to ``8``): +By default, CDN in a Box will be based on CentOS 8. To base CDN in a Box on CentOS 7, set the ``RHEL_VERSION`` environment variable to ``7`` (for CDN in a Box, it defaults to ``8``): .. code-block:: shell :caption: Building CDN in a Box to run CentOS 7 instead of CentOS 8 - docker-compose build --parallel --build-arg CENTOS_VERSION=7 + export RHEL_VERSION=7 + make # Builds RPMs for CentOS 7 + docker-compose build --parallel # Builds CentOS 7 CDN in a Box images The image that takes the takes the longest to build is the ``trafficops-perl`` image. In order to avoid needing to download, build, and test 239 Perl CPAN modules each time you rebuild the image from scratch, you can run the following command while running CDN in a Box in order to skip building the Perl modules next time: diff --git a/docs/source/admin/traffic_portal/installation.rst b/docs/source/admin/traffic_portal/installation.rst index 5e4b3c5f98..077dd4ecec 100644 --- a/docs/source/admin/traffic_portal/installation.rst +++ b/docs/source/admin/traffic_portal/installation.rst @@ -16,7 +16,7 @@ ***************************** Traffic Portal Administration ***************************** -Traffic Portal is only supported on CentOS Linux distributions version 7.x. It runs on `NodeJS `_ and requires version 12 or higher. +Traffic Portal is only supported on CentOS Linux distributions version 7.x and 8.x. It runs on `NodeJS `_ and requires version 12 or higher. Installing Traffic Portal diff --git a/docs/source/admin/traffic_router/migrationto2-3.rst b/docs/source/admin/traffic_router/migrationto2-3.rst index bb8889ca3f..31607485dc 100644 --- a/docs/source/admin/traffic_router/migrationto2-3.rst +++ b/docs/source/admin/traffic_router/migrationto2-3.rst @@ -33,7 +33,7 @@ Release Notes v3.0 System Requirements =================== -* Centos 7.2 +* Centos 7.9 or CentOS 8.2 * OpenSSL >= 1.0.2 installed * JDK >= 8.0 installed or available in an accessible :manpage:`yum(8)` repository * :abbr:`APR (Apache Portable Runtime)` >= 1.4.8-3 installed or available in an accessible :manpage:`yum(8)` repository diff --git a/docs/source/development/building.rst b/docs/source/development/building.rst index 58d11ad2ca..43f850dfd9 100644 --- a/docs/source/development/building.rst +++ b/docs/source/development/building.rst @@ -20,7 +20,7 @@ Building Traffic Control ************************ The build steps for Traffic Control components are all pretty much the same, despite that they are written in a variety of different languages and frameworks. This is accomplished by using Docker. -.. note:: Currently, both listed methods of building Traffic Control components will produce ``*.rpm`` files, meaning that the support of these components is limited to RedHat-based distributions - and none of them are currently tested (or guaranteed to work) outside of CentOS7, specifically. +.. note:: Currently, both listed methods of building Traffic Control components will produce ``*.rpm`` files, meaning that the support of these components is limited to RedHat-based distributions - and none of them are currently tested (or guaranteed to work) outside of CentOS 7 and CentOS 8, specifically. Downloading Traffic Control =========================== @@ -48,9 +48,14 @@ Usage Options --q Quiet mode. Suppresses output. --v Verbose mode. Lists all build output. --l List available projects. +-7 Build RPMs targeting CentOS 7 (default) +-8 Build RPMs targeting CentOS 8 +-b Build builder Docker images before building projects +-d Disable compiler optimizations for debugging. +-l List available projects. +-p Pull builder Docker images, do not build them (default) +-q Quiet mode. Supresses output. (default) +-v Verbose mode. Lists all build output. If present, ``projects`` should be one or more project names. When no specific project or project list is given the default projects will be built. Valid projects: @@ -162,7 +167,12 @@ This is the equivalent of running If any component fails to build, no further component builds will be attempted. -Regardless of which OS the RPMs were built on, they are meant to be installed on CentOS 7. The exception is if the RPMs were built on CentOS 8, in which case the target OS for the RPMs is CentOS 8. +By default, the RPMs will be built targeting CentOS 7. CentOS 8 is also a supported build target. You can choose which CentOS version to build for (7, 8, etc.) by setting the ``RHEL_VERSION`` environment variable: + +.. code-block:: shell + :caption: Building RPMs that target CentOS 8 without the build host needing to be CentOS 8 + + export RHEL_VERSION=8 .. warning:: Although there are no known issues with natively-built RPMs, the official, supported method of building the RPMs is by using :ref:`pkg ` or :ref:`docker-compose `. Use natively-built RPMs at your own risk. diff --git a/docs/source/overview/profiles_and_parameters.rst b/docs/source/overview/profiles_and_parameters.rst index 49ba61b067..ea60872509 100644 --- a/docs/source/overview/profiles_and_parameters.rst +++ b/docs/source/overview/profiles_and_parameters.rst @@ -478,7 +478,7 @@ Furthermore, for a given value of ``N``, if a Parameter exists on the :term:`cac package ''''''' -This is a special, reserved Config File that isn't a file at all. When a Parameter's Config File is ``package``, then its name is interpreted as the name of a package. :term:`ORT` on the server using the :ref:`Profile ` that has this Parameter will attempt to install a package by that name, interpreting the Parameter's Value_ as a version string if it is not empty. The package manager used will be :manpage:`yum(8)`, regardless of system (though the Python version of :term:`ORT` will attempt to use the host system's package manager - :manpage:`yum(8)`, :manpage:`apt(8)` and ``pacman`` are supported) but that shouldn't be a problem because only CentOS 7 is supported. +This is a special, reserved Config File that isn't a file at all. When a Parameter's Config File is ``package``, then its name is interpreted as the name of a package. :term:`ORT` on the server using the :ref:`Profile ` that has this Parameter will attempt to install a package by that name, interpreting the Parameter's Value_ as a version string if it is not empty. The package manager used will be :manpage:`yum(8)`, regardless of system (though the Python version of :term:`ORT` will attempt to use the host system's package manager - :manpage:`yum(8)`, :manpage:`apt(8)` and ``pacman`` are supported) but that shouldn't be a problem because only CentOS 7 and CentOS 8 are supported. The current implementation of :term:`ORT` will expect Parameters to exist on a :term:`cache server`'s :ref:`Profile ` with the :ref:`Names ` ``astats_over_http`` and ``trafficserver`` before being run the first time, as both of these are required for a :term:`cache server` to operate within a Traffic Control CDN. It is possible to install these outside of :term:`ORT` - and indeed even outside of :manpage:`yum(8)` - but such configuration is not officially supported. diff --git a/infrastructure/cdn-in-a-box/Makefile b/infrastructure/cdn-in-a-box/Makefile index 94d3a8c47f..3c4abece03 100644 --- a/infrastructure/cdn-in-a-box/Makefile +++ b/infrastructure/cdn-in-a-box/Makefile @@ -29,18 +29,22 @@ ifneq ($(PWD),$(makefile_dir)) $(error This makefile MUST be run from within its directory) endif +ifeq ($(RHEL_VERSION),) + export RHEL_VERSION := 8 +else + RHEL_VERSION := $(shell echo $(RHEL_VERSION) | cut -f1 -d.) +endif + PKG_COMMAND := ../../pkg -PKG_FLAGS := -v +PKG_FLAGS := -v -$(RHEL_VERSION) BUILD_SUFFIX := _build BUILD_NUMBER := $(shell git rev-list HEAD 2>/dev/null | wc -l | tr -d '[[:space:]]').$(shell git rev-parse --short=8 HEAD) TC_VERSION := $(shell cat "../../VERSION") TOMCAT_VERSION := $(shell grep '^\s*TOMCAT_VERSION=' ../../traffic_router/build/build_rpm.sh | cut -d= -f2) TOMCAT_RELEASE := $(shell grep '^\s*TOMCAT_RELEASE=' ../../traffic_router/build/build_rpm.sh | cut -d= -f2) -RHEL_VERSION := el7 - -SPECIAL_SAUCE := $(TC_VERSION)-$(BUILD_NUMBER).$(RHEL_VERSION).x86_64.rpm -SPECIAL_SEASONING := $(TOMCAT_VERSION).$(TOMCAT_RELEASE)-$(BUILD_NUMBER).$(RHEL_VERSION).x86_64.rpm +SPECIAL_SAUCE := $(TC_VERSION)-$(BUILD_NUMBER).el$(RHEL_VERSION).x86_64.rpm +SPECIAL_SEASONING := $(TOMCAT_VERSION).$(TOMCAT_RELEASE)-$(BUILD_NUMBER).el$(RHEL_VERSION).x86_64.rpm TO_SOURCE := $(wildcard ../../traffic_ops/**/*) TO_SOURCE += $(wildcard ../../traffic_ops_db/**/*) @@ -51,11 +55,21 @@ TP_SOURCE := $(wildcard ../../traffic_portal/**/*) TR_SOURCE := $(wildcard ../../traffic_router/**/*) TS_SOURCE := $(wildcard ../../traffic_stats/**/*) -.PHONY: clean very-clean all nearly-all debug native +.PHONY: all build-builders clean debug native nearly-all pull-builders very-clean # Default target; builds all pre-requisite rpms from source trees all: cache/traffic_ops_ort.rpm traffic_monitor/traffic_monitor.rpm traffic_portal/traffic_portal.rpm traffic_ops/traffic_ops.rpm traffic_router/traffic_router.rpm traffic_router/tomcat.rpm traffic_stats/traffic_stats.rpm +ifneq ($(filter build-builders,$(MAKECMDGOALS)),) +PKG_FLAGS += -b +ifneq ($(MAKECMDGOALS),build-builders) +MAKECMDGOALS := $(filter-out build-builders,$(MAKECMDGOALS)) +build-builders: $(MAKECMDGOALS) +else +build-builders: all +endif +endif + ifneq ($(filter debug,$(MAKECMDGOALS)),) PKG_FLAGS += -d export DEBUG_BUILD = true @@ -79,7 +93,15 @@ native: all endif endif -#.PHONY: native +ifneq ($(filter pull-builders,$(MAKECMDGOALS)),) +PKG_FLAGS += -p +ifneq ($(MAKECMDGOALS),pull-builders) +MAKECMDGOALS := $(filter-out pull-builders,$(MAKECMDGOALS)) +pull-builders: $(MAKECMDGOALS) +else +pull-builders: all +endif +endif # Actual output rpm recipies traffic_monitor/traffic_monitor.rpm: ../../dist/traffic_monitor-$(SPECIAL_SAUCE) diff --git a/infrastructure/cdn-in-a-box/docker-compose.traffic-portal-test.yml b/infrastructure/cdn-in-a-box/docker-compose.traffic-portal-test.yml index 59ad76bb8a..0b9cc4c24c 100644 --- a/infrastructure/cdn-in-a-box/docker-compose.traffic-portal-test.yml +++ b/infrastructure/cdn-in-a-box/docker-compose.traffic-portal-test.yml @@ -32,7 +32,7 @@ services: context: ../.. dockerfile: infrastructure/cdn-in-a-box/traffic_portal_integration_test/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} env_file: - variables.env hostname: portal-integration diff --git a/infrastructure/cdn-in-a-box/docker-compose.yml b/infrastructure/cdn-in-a-box/docker-compose.yml index 943ee4ae46..878e363a14 100644 --- a/infrastructure/cdn-in-a-box/docker-compose.yml +++ b/infrastructure/cdn-in-a-box/docker-compose.yml @@ -59,7 +59,7 @@ services: context: . dockerfile: traffic_ops/Dockerfile-go args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} TRAFFIC_OPS_RPM: traffic_ops/traffic_ops.rpm depends_on: - db @@ -81,7 +81,7 @@ services: context: ../.. dockerfile: infrastructure/cdn-in-a-box/traffic_ops/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} TRAFFIC_OPS_RPM: infrastructure/cdn-in-a-box/traffic_ops/traffic_ops.rpm depends_on: - db @@ -106,7 +106,7 @@ services: context: . dockerfile: traffic_portal/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} TRAFFIC_PORTAL_RPM: traffic_portal/traffic_portal.rpm depends_on: - enroller @@ -124,7 +124,7 @@ services: context: . dockerfile: traffic_monitor/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} TRAFFIC_MONITOR_RPM: traffic_monitor/traffic_monitor.rpm depends_on: - enroller @@ -142,7 +142,7 @@ services: context: . dockerfile: traffic_router/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} TRAFFIC_ROUTER_RPM: traffic_router/traffic_router.rpm TOMCAT_RPM: traffic_router/tomcat.rpm depends_on: @@ -160,7 +160,7 @@ services: context: . dockerfile: traffic_stats/Dockerfile args: - CENTOS_VERSION: ${CENTOS_VERSION:-8} + RHEL_VERSION: ${RHEL_VERSION:-8} image: trafficstats depends_on: - enroller diff --git a/infrastructure/cdn-in-a-box/edge/Dockerfile b/infrastructure/cdn-in-a-box/edge/Dockerfile index 9ab0579327..f4e50cbf59 100644 --- a/infrastructure/cdn-in-a-box/edge/Dockerfile +++ b/infrastructure/cdn-in-a-box/edge/Dockerfile @@ -21,18 +21,18 @@ # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} AS common-cache-server-layers -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} AS common-cache-server-layers +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi EXPOSE 80 RUN dnf -y install epel-release && \ - if [[ "${CENTOS_VERSION%%.*}" -ge 8 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -ge 8 ]]; then \ additional_packages='compat-openssl10 pkgconf-pkg-config' || \ exit 1; \ else \ @@ -81,7 +81,7 @@ RUN dnf -y install epel-release && \ perl-URI \ tcl \ $additional_packages && \ - if [[ "${CENTOS_VERSION%%.*}" -eq 8 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -eq 8 ]]; then \ set -- \ # Pretend that we have the right library versions. # TODO: Use a proper CentOS 7 or 8 RPM once trafficserver diff --git a/infrastructure/cdn-in-a-box/mid/Dockerfile b/infrastructure/cdn-in-a-box/mid/Dockerfile index d72f5ad7c1..591a3eb94d 100644 --- a/infrastructure/cdn-in-a-box/mid/Dockerfile +++ b/infrastructure/cdn-in-a-box/mid/Dockerfile @@ -21,18 +21,18 @@ # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} AS common-cache-server-layers -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} AS common-cache-server-layers +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi EXPOSE 80 RUN dnf -y install epel-release && \ - if [[ "${CENTOS_VERSION%%.*}" -ge 8 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -ge 8 ]]; then \ additional_packages='compat-openssl10 pkgconf-pkg-config' || \ exit 1; \ else \ @@ -81,7 +81,7 @@ RUN dnf -y install epel-release && \ perl-URI \ tcl \ $additional_packages && \ - if [[ "${CENTOS_VERSION%%.*}" -eq 8 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -eq 8 ]]; then \ set -- \ # Pretend that we have the right library versions. # TODO: Use a proper CentOS 7 or 8 RPM once trafficserver diff --git a/infrastructure/cdn-in-a-box/optional/docker-compose.socksproxy.yml b/infrastructure/cdn-in-a-box/optional/docker-compose.socksproxy.yml index 11d15de35a..b45783d8ff 100644 --- a/infrastructure/cdn-in-a-box/optional/docker-compose.socksproxy.yml +++ b/infrastructure/cdn-in-a-box/optional/docker-compose.socksproxy.yml @@ -45,7 +45,7 @@ services: context: . dockerfile: optional/socksproxy/Dockerfile args: - CENTOS_VERSION: 8 + RHEL_VERSION: 8 hostname: socksproxy domainname: infra.ciab.test volumes: diff --git a/infrastructure/cdn-in-a-box/optional/docker-compose.vnc.yml b/infrastructure/cdn-in-a-box/optional/docker-compose.vnc.yml index 0b26682d40..0cbf84c14e 100644 --- a/infrastructure/cdn-in-a-box/optional/docker-compose.vnc.yml +++ b/infrastructure/cdn-in-a-box/optional/docker-compose.vnc.yml @@ -48,7 +48,7 @@ services: context: . dockerfile: optional/vnc/Dockerfile args: - CENTOS_VERSION: 8 + RHEL_VERSION: 8 VNC_BUILD_USER: "ciabuser" depends_on: - dns diff --git a/infrastructure/cdn-in-a-box/optional/socksproxy/Dockerfile b/infrastructure/cdn-in-a-box/optional/socksproxy/Dockerfile index 01e21d4421..1fe7d75613 100644 --- a/infrastructure/cdn-in-a-box/optional/socksproxy/Dockerfile +++ b/infrastructure/cdn-in-a-box/optional/socksproxy/Dockerfile @@ -19,11 +19,11 @@ # Dockerfile to build optional CiaB Socks Proxy # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/optional/vnc/Dockerfile b/infrastructure/cdn-in-a-box/optional/vnc/Dockerfile index a446a8b7c7..d002090069 100644 --- a/infrastructure/cdn-in-a-box/optional/vnc/Dockerfile +++ b/infrastructure/cdn-in-a-box/optional/vnc/Dockerfile @@ -15,11 +15,11 @@ # specific language governing permissions and limitations # under the License. -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile index 8f37220c79..ffa9ab285b 100644 --- a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile @@ -19,11 +19,11 @@ # Based on CentOS ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile-debug b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile-debug index 948c174b60..4a8a4fe35a 100644 --- a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile-debug +++ b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile-debug @@ -20,11 +20,11 @@ # Based on CentOS ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as get-delve -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as get-delve +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile index a675f4ccd0..5b3e42d75e 100644 --- a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile @@ -23,24 +23,24 @@ # Keep the trafficops-common-deps in Dockerfile the same as # trafficops-common-deps in Dockerfile-go to cache the same # layer. -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as trafficops-common-deps -ARG CENTOS_VERSION=8 -# Makes CENTOS_VERSION available in later layers without needing to specify it again -ENV CENTOS_VERSION=$CENTOS_VERSION +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as trafficops-common-deps +ARG RHEL_VERSION=8 +# Makes RHEL_VERSION available in later layers without needing to specify it again +ENV RHEL_VERSION=$RHEL_VERSION -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi RUN set -o nounset -o errexit && \ mkdir -p /etc/cron.d; \ - if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ use_repo=''; \ else \ use_repo='--repo=pgdg96'; \ fi; \ - dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${CENTOS_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \ + dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${RHEL_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \ dnf -y $use_repo -- install postgresql96; \ dnf -y install epel-release; \ dnf -y install \ @@ -62,7 +62,7 @@ FROM trafficops-common-deps as trafficops-perl-deps EXPOSE 443 ENV MOJO_MODE production -RUN if [[ "${CENTOS_VERSION%%.*}" -ge 8 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -ge 8 ]]; then \ enable_repo='--enablerepo=PowerTools' || exit 1; \ fi && \ dnf -y --allowerasing $enable_repo install \ diff --git a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go index 2101902790..3e949fd346 100644 --- a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go +++ b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go @@ -23,22 +23,22 @@ # Keep the trafficops-common-deps in Dockerfile-go the same # as trafficops-common-deps in Dockerfile to cache the same # layer. -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as trafficops-common-deps -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as trafficops-common-deps +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi RUN set -o nounset -o errexit && \ mkdir -p /etc/cron.d; \ - if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ + if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ include_repo=''; \ else \ include_repo='--repo=pgdg96'; \ fi; \ - dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${CENTOS_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \ + dnf -y install "https://download.postgresql.org/pub/repos/yum/reporpms/EL-${RHEL_VERSION%%.*}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"; \ dnf -y $include_repo -- install postgresql96; \ dnf -y install epel-release; \ dnf -y install \ diff --git a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go-debug b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go-debug index be661d0f61..be6c30d028 100644 --- a/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go-debug +++ b/infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-go-debug @@ -20,11 +20,11 @@ # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as get-delve -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as get-delve +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_portal/Dockerfile b/infrastructure/cdn-in-a-box/traffic_portal/Dockerfile index 07a9c52b4d..4441d916f7 100644 --- a/infrastructure/cdn-in-a-box/traffic_portal/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_portal/Dockerfile @@ -20,11 +20,11 @@ # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_portal_integration_test/Dockerfile b/infrastructure/cdn-in-a-box/traffic_portal_integration_test/Dockerfile index 39c1cde118..be2dae121c 100644 --- a/infrastructure/cdn-in-a-box/traffic_portal_integration_test/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_portal_integration_test/Dockerfile @@ -15,18 +15,18 @@ # specific language governing permissions and limitations # under the License. -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as os-dependencies -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as os-dependencies +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi # Installs the Google Chrome dnf repo COPY infrastructure/cdn-in-a-box/traffic_portal_integration_test/etc etc -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ utils_package=yum-utils; \ else \ utils_package=dnf-utils; \ diff --git a/infrastructure/cdn-in-a-box/traffic_router/Dockerfile b/infrastructure/cdn-in-a-box/traffic_router/Dockerfile index 6d8bca7818..d3029154c4 100644 --- a/infrastructure/cdn-in-a-box/traffic_router/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_router/Dockerfile @@ -19,11 +19,11 @@ # Based on CentOS 8 ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile b/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile index a9d6c06f52..1f09127d51 100644 --- a/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile +++ b/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile @@ -19,11 +19,11 @@ # Based on CentOS ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile-debug b/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile-debug index 9c49f6f0d9..976e0c45d0 100644 --- a/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile-debug +++ b/infrastructure/cdn-in-a-box/traffic_stats/Dockerfile-debug @@ -20,11 +20,11 @@ # Based on CentOS ############################################################ -ARG CENTOS_VERSION=8 -FROM centos:${CENTOS_VERSION} as get-delve -ARG CENTOS_VERSION=8 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as get-delve +ARG RHEL_VERSION=8 -RUN if [[ "${CENTOS_VERSION%%.*}" -eq 7 ]]; then \ +RUN if [[ "${RHEL_VERSION%%.*}" -eq 7 ]]; then \ yum -y install dnf || exit 1; \ fi diff --git a/infrastructure/docker/build/Dockerfile-docs b/infrastructure/docker/build/Dockerfile-docs index a37079a0c8..28fee6d7d3 100644 --- a/infrastructure/docker/build/Dockerfile-docs +++ b/infrastructure/docker/build/Dockerfile-docs @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,21 +25,29 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### docs specific requirements +FROM common-dependencies AS docs + ADD docs/source/requirements.txt /docs.requirements.txt RUN yum -y install \ - python36 \ - python36-pip \ - python36-psutil \ - git \ - rpm-build \ + python3 \ + python3-pip \ + python3-psutil \ make && \ yum -y clean all RUN python3 -m pip install --upgrade setuptools && \ diff --git a/infrastructure/docker/build/Dockerfile-grove b/infrastructure/docker/build/Dockerfile-grove index 9996ed21dd..2111773101 100644 --- a/infrastructure/docker/build/Dockerfile-grove +++ b/infrastructure/docker/build/Dockerfile-grove @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,18 +25,23 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### grove specific requirements -RUN yum -y install \ - git \ - rpm-build && \ - yum -y clean all +FROM common-dependencies AS grove COPY GO_VERSION / RUN go_version=$(cat /GO_VERSION) && \ diff --git a/infrastructure/docker/build/Dockerfile-grovetccfg b/infrastructure/docker/build/Dockerfile-grovetccfg index 34679d9a34..658b647de8 100644 --- a/infrastructure/docker/build/Dockerfile-grovetccfg +++ b/infrastructure/docker/build/Dockerfile-grovetccfg @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,18 +25,23 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### grovetccfg specific requirements -RUN yum -y install \ - git \ - rpm-build && \ - yum -y clean all +FROM common-dependencies AS grovetccfg COPY GO_VERSION / RUN go_version=$(cat /GO_VERSION) && \ diff --git a/infrastructure/docker/build/Dockerfile-source b/infrastructure/docker/build/Dockerfile-source index 9de6c3c6ee..3b8e1cc9b4 100644 --- a/infrastructure/docker/build/Dockerfile-source +++ b/infrastructure/docker/build/Dockerfile-source @@ -14,27 +14,34 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org -### # top level of trafficcontrol directory must be mounted as a volume: # docker run --volume /trafficcontrol:$(pwd) ... VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### source specific requirements -RUN yum -y install \ - git && \ - yum -y clean all +FROM common-dependencies AS source WORKDIR /trafficcontrol CMD build/clean_build.sh tarball diff --git a/infrastructure/docker/build/Dockerfile-traffic_monitor b/infrastructure/docker/build/Dockerfile-traffic_monitor index 74a906654b..a84e68a2c1 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_monitor +++ b/infrastructure/docker/build/Dockerfile-traffic_monitor @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,19 +25,27 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### traffic_monitor specific requirements +FROM common-dependencies AS traffic-monitor + RUN yum -y install \ # gcc is necessary in case -gcflags 'all=-N -l' is passed to go build - gcc \ - git \ - rpm-build && \ + gcc && \ yum -y clean all COPY GO_VERSION / diff --git a/infrastructure/docker/build/Dockerfile-traffic_ops b/infrastructure/docker/build/Dockerfile-traffic_ops index 3f4ab376a5..a49d91fb50 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_ops +++ b/infrastructure/docker/build/Dockerfile-traffic_ops @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,23 +25,31 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### traffic_ops specific requirements +FROM common-dependencies AS traffic-ops + RUN yum -y install \ expat-devel \ gcc \ - git \ libcurl-devel \ make \ openssl-devel \ perl-ExtUtils-MakeMaker \ - rpm-build \ tar && \ yum -y clean all diff --git a/infrastructure/docker/build/Dockerfile-traffic_ops_ort b/infrastructure/docker/build/Dockerfile-traffic_ops_ort index 550ab95d30..1aa3661343 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_ops_ort +++ b/infrastructure/docker/build/Dockerfile-traffic_ops_ort @@ -14,18 +14,35 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 + +MAINTAINER dev@trafficcontrol.apache.org # top level of trafficcontrol directory must be mounted as a volume: # docker run --volume /trafficcontrol:$(pwd) ... VOLUME /trafficcontrol ### Common for all sub-component builds -RUN yum -y install \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ + yum -y update ca-certificates && \ + yum -y install \ git \ - rpm-build && \ + rpm-build \ + rsync \ + epel-release && \ yum -y clean all +### traffic_ops_ort specific requirements +FROM common-dependencies AS traffic-ops-ort + COPY GO_VERSION / RUN go_version=$(cat /GO_VERSION) && \ curl -Lo go.tar.gz https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \ diff --git a/infrastructure/docker/build/Dockerfile-traffic_portal b/infrastructure/docker/build/Dockerfile-traffic_portal index 8d516bc36e..3aef174e3e 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_portal +++ b/infrastructure/docker/build/Dockerfile-traffic_portal @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,22 +25,30 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all -# traffic_portal specific +### traffic_portal specific +FROM common-dependencies AS traffic-portal + RUN yum -y install \ gcc \ - git \ libffi-devel \ make \ nodejs \ npm \ - rpm-build \ ruby-devel \ rubygems diff --git a/infrastructure/docker/build/Dockerfile-traffic_router b/infrastructure/docker/build/Dockerfile-traffic_router index 263a811d76..e91982a9b8 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_router +++ b/infrastructure/docker/build/Dockerfile-traffic_router @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,21 +25,29 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### traffic_router specific requirements +FROM common-dependencies AS traffic-router + RUN yum -y install \ which \ - curl \ - git \ - java-1.8.0-openjdk \ - java-1.8.0-openjdk-devel \ - rpm-build && \ + curl \ + java-1.8.0-openjdk \ + java-1.8.0-openjdk-devel && \ yum -y clean all ENV JAVA_HOME=/usr/lib/jvm/java diff --git a/infrastructure/docker/build/Dockerfile-traffic_stats b/infrastructure/docker/build/Dockerfile-traffic_stats index 3901b89e1c..b791b7f95b 100644 --- a/infrastructure/docker/build/Dockerfile-traffic_stats +++ b/infrastructure/docker/build/Dockerfile-traffic_stats @@ -14,7 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -FROM centos:7 +ARG RHEL_VERSION=8 +FROM centos:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 MAINTAINER dev@trafficcontrol.apache.org @@ -23,18 +25,23 @@ MAINTAINER dev@trafficcontrol.apache.org VOLUME /trafficcontrol ### Common for all sub-component builds -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ +RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \ + rpm_gpg_key=RPM-GPG-KEY-centosofficial; \ + else \ + rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \ + fi && \ + rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ yum -y update ca-certificates && \ yum -y install \ + git \ + rpm-build \ + rsync \ epel-release && \ yum -y clean all ### traffic_stats specific requirements -RUN yum -y install \ - git \ - rpm-build && \ - yum -y clean all +FROM common-dependencies AS traffic-stats COPY GO_VERSION / RUN go_version=$(cat /GO_VERSION) && \ diff --git a/infrastructure/docker/build/docker-compose.yml b/infrastructure/docker/build/docker-compose.yml index e2fb397183..f301949c4c 100644 --- a/infrastructure/docker/build/docker-compose.yml +++ b/infrastructure/docker/build/docker-compose.yml @@ -20,74 +20,92 @@ version: '2' services: source: image: apache/traffic_source_tarballer:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-source - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-source + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z traffic_monitor_build: image: apache/traffic_monitor_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_monitor - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_monitor + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z traffic_ops_build: image: apache/traffic_ops_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_ops - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_ops + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z traffic_ops_ort_build: image: apache/traffic_ops_ort_builder:master - # build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_ops_ort - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_ops_ort + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z traffic_portal_build: image: apache/traffic_portal_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_portal - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_portal + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z traffic_router_build: image: apache/traffic_router_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_router - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_router + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z - ../../../.m2:/root/.m2:z traffic_stats_build: image: apache/traffic_stats_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-traffic_stats - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-traffic_stats + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z grove_build: image: apache/traffic_grove_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-grove - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-grove + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z grovetccfg_build: image: apache/traffic_grovetccfg_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-grovetccfg - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-grovetccfg + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z @@ -99,8 +117,10 @@ services: docs: image: apache/traffic_docs_builder:master - #build: - # dockerfile: infrastructure/docker/build/Dockerfile-docs - # context: ../../.. + build: + dockerfile: infrastructure/docker/build/Dockerfile-docs + context: ../../.. + args: + RHEL_VERSION: ${RHEL_VERSION:-8} volumes: - ../../..:/trafficcontrol:z diff --git a/pkg b/pkg index 2187592f0d..fab4b7ef74 100755 --- a/pkg +++ b/pkg @@ -82,32 +82,41 @@ if [ ${#COMPOSECMD[@]} -eq 0 ]; then COMPOSECMD=(docker run --rm "${DOCKER_ADDR[@]}" $COMPOSE_OPTIONS "${VOLUMES[@]}" -w "$(pwd)" $IMAGE) fi +# Mark RHEL_VERSION for export, although it is not set yet +export RHEL_VERSION +RUN_OPTIONS=(-e RHEL_VERSION) + # Parse command line arguments verbose=0 -while getopts :qvld? opt; do +while getopts :?78bdlpqv opt; do case $opt in \?) - PROJECTS=`$SELF -l | sed "s/^/ - /"` - echo "Usage: $SELF [options] [projects]" - echo " -q Quiet mode. Supresses output." - echo " -v Verbose mode. Lists all build output." - echo " -l List available projects." - echo " -d Disable compiler optimizations for debugging." - echo - echo " If no projects are listed, all projects will be packaged." - echo " Valid projects:" - cat <<< "$PROJECTS" + PROJECTS=`$SELF -l | sed "s/^/ - /"` + <<-HELP_TEXT cat + Usage: $SELF [options] [projects] + -7 Build RPMs targeting CentOS 7 (default) + -8 Build RPMs targeting CentOS 8 + -b Build builder Docker images before building projects + -d Disable compiler optimizations for debugging. + -l List available projects. + -p Pull builder Docker images, do not build them (default) + -q Quiet mode. Supresses output. (default) + -v Verbose mode. Lists all build output. + + If no projects are listed, all projects will be packaged. + Valid projects: + $PROJECTS + HELP_TEXT exit 0 ;; - q) - exec >/dev/null 2>&1 + 7) + RHEL_VERSION=7 ;; - v) - verbose=1 + 8) + RHEL_VERSION=8 ;; - l) - "${COMPOSECMD[@]}" -f $COMPOSE_FILE config --services - exit $? + b) + build_images=1 ;; d) echo '-d is set! Disabling all compiler optimizations for debugging...'; @@ -115,6 +124,19 @@ while getopts :qvld? opt; do # RPM packaging will not strip binaries. RUN_OPTIONS+=(-e 'DEBUG_BUILD=true'); ;; + l) + "${COMPOSECMD[@]}" -f $COMPOSE_FILE config --services + exit $? + ;; + p) + build_images=0 + ;; + q) + exec >/dev/null 2>&1 + ;; + v) + verbose=1 + ;; esac done @@ -134,8 +156,11 @@ while (( "$#" )); do if (( "$verbose" == 0 )); then exec >/dev/null 2>&1 fi - "${COMPOSECMD[@]}" -f $COMPOSE_FILE pull $1 || exit 1 - "${COMPOSECMD[@]}" -f $COMPOSE_FILE build --pull $1 || exit 1 + if [[ $build_images -eq 1 ]]; then + "${COMPOSECMD[@]}" -f $COMPOSE_FILE build $1 || exit 1 + else + "${COMPOSECMD[@]}" -f $COMPOSE_FILE pull $1 || exit 1 + fi "${COMPOSECMD[@]}" -f $COMPOSE_FILE run "${RUN_OPTIONS[@]}" --rm $1 || exit 1 ) || { # Don't totally bail out, but make note of the failures. diff --git a/traffic_ops_ort/build/traffic_ops_ort.spec b/traffic_ops_ort/build/traffic_ops_ort.spec index b5a5c567b0..1d3e33cf28 100644 --- a/traffic_ops_ort/build/traffic_ops_ort.spec +++ b/traffic_ops_ort/build/traffic_ops_ort.spec @@ -28,6 +28,7 @@ Vendor: Apache Software Foundation Packager: dev at trafficcontrol dot Apache dot org %{?el6:Requires: perl-JSON, perl-libwww-perl, perl-Crypt-SSLeay, perl-Digest-SHA} %{?el7:Requires: perl-JSON, perl-libwww-perl, perl-Crypt-SSLeay, perl-LWP-Protocol-https, perl-Digest-SHA} +%{?el8:Requires: perl-JSON, perl-libwww-perl, perl-Net-SSLeay, perl-LWP-Protocol-https, perl-Digest-SHA} %description