From 3fbea4eaa15eeff4fda8c250611c6c42366e0f67 Mon Sep 17 00:00:00 2001 From: Keiko Oda Date: Wed, 3 Jul 2024 09:39:44 +0900 Subject: [PATCH] Add workaround for CentOS 7 (#558) Change the base package of RPM from CentOS 7 to Amazon Linux 2 --- CHANGELOG.md | 3 +++ packages/README.md | 4 ++-- packages/repo/Dockerfile.repo-rpm | 5 +---- packages/src/Dockerfile.build.rpm-systemd | 12 +++++++----- packages/test/Makefile | 3 ++- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c636aeaad..a80cc8412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ * Add packages for Ubuntu 24.04 * Remove "report" functionality - This has long been deprecated. Removing the code as a cleanup +* Stop building packages for CentOS 7 / RHEL 7 + * CentOS 7 / RHEL 7 is end of life. The minimum required glibc version for RPM packages is + now 2.26 (e.g. Amazon Linux 2) ## 0.56.0 2024-04-19 diff --git a/packages/README.md b/packages/README.md index 2ba1dcfb5..47f953816 100644 --- a/packages/README.md +++ b/packages/README.md @@ -31,8 +31,8 @@ When changing the initial package build step one needs to be careful to not incr Currently the following minimum glibc versions apply: -* RPM, systemd: glibc 2.17 (CentOS 7) -* DEB, systemd: glibc 2.19 (Debian Jessie) +* RPM, systemd: glibc 2.26 (Amazon Linux 2) +* DEB, systemd: glibc 2.31 (Debian Bullseye) Requirements diff --git a/packages/repo/Dockerfile.repo-rpm b/packages/repo/Dockerfile.repo-rpm index b6bf6c20e..d1438d27d 100644 --- a/packages/repo/Dockerfile.repo-rpm +++ b/packages/repo/Dockerfile.repo-rpm @@ -1,7 +1,4 @@ -FROM centos:7 - -# Replace with ARM base image when building on ARM: -#FROM arm64v8/centos:7 +FROM amazonlinux:2 # Build arguments ARG VERSION diff --git a/packages/src/Dockerfile.build.rpm-systemd b/packages/src/Dockerfile.build.rpm-systemd index b310c9a17..24dcbc50d 100644 --- a/packages/src/Dockerfile.build.rpm-systemd +++ b/packages/src/Dockerfile.build.rpm-systemd @@ -1,4 +1,4 @@ -FROM centos:7 +FROM amazonlinux:2 ARG TARGETARCH ENV GOPATH /go @@ -9,12 +9,14 @@ ENV ROOT_DIR /root ENV SOURCE_DIR /source # Packages required for both building and packaging -# +RUN yum install -y centos-release-scl scl-utils tar make git rpmdevtools gcc + # This uses Ruby 3.0 since 2.7 (which still used for Debian builds) does not work with fpm: https://github.com/jordansissel/fpm/issues/2048#issuecomment-1972196104 -RUN yum install -y centos-release-scl scl-utils tar make git rpmdevtools gcc && yum install -y rh-ruby30 rh-ruby30-ruby-devel +RUN amazon-linux-extras install ruby3.0 +RUN yum install -y ruby-devel # FPM -RUN source scl_source enable rh-ruby30 && gem install fpm -v 1.14.1 +RUN gem install fpm -v 1.14.1 # Golang RUN curl -o go.tar.gz -sSL "https://go.dev/dl/go${GOVERSION}.linux-${TARGETARCH}.tar.gz" @@ -50,7 +52,7 @@ RUN cp $CODE_DIR/contrib/sslrootcert/* $SOURCE_DIR/usr/share/pganalyze-collector # Build the package WORKDIR $ROOT_DIR -RUN scl enable rh-ruby30 -- fpm \ +RUN fpm \ -n $NAME -v ${VERSION} -t rpm --rpm-os linux \ --config-files /etc/pganalyze-collector.conf \ --after-install $CODE_DIR/packages/src/rpm-systemd/post.sh \ diff --git a/packages/test/Makefile b/packages/test/Makefile index 415a18e72..eb94ca139 100644 --- a/packages/test/Makefile +++ b/packages/test/Makefile @@ -9,7 +9,8 @@ docker_test_and_clean = docker exec pga-collector-test /root/systemd_test.sh && # Note: The default list excludes rockylinux9 since there is an open issue with # /sbin/init not being present, see https://github.com/rocky-linux/sig-cloud-instance-images/issues/39 -DISTROS=centos7 rhel8 rockylinux8 rhel9 fedora36 fedora37 amazonlinux2 amazonlinux2023 ubuntu-focal ubuntu-jammy ubuntu-noble debian-bullseye debian-bookworm +# Note: The default list also excludes centos7 since it's EOL, we will drop the support near future +DISTROS=rhel8 rockylinux8 rhel9 fedora36 fedora37 amazonlinux2 amazonlinux2023 ubuntu-focal ubuntu-jammy ubuntu-noble debian-bullseye debian-bookworm .PHONY: all $(DISTROS)