Skip to content

Commit

Permalink
Add workaround for CentOS 7 (#558)
Browse files Browse the repository at this point in the history
Change the base package of RPM from CentOS 7 to Amazon Linux 2
  • Loading branch information
keiko713 authored Jul 3, 2024
1 parent e51bb24 commit 3fbea4e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions packages/repo/Dockerfile.repo-rpm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 7 additions & 5 deletions packages/src/Dockerfile.build.rpm-systemd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:7
FROM amazonlinux:2

ARG TARGETARCH
ENV GOPATH /go
Expand All @@ -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"
Expand Down Expand Up @@ -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 \
Expand Down
3 changes: 2 additions & 1 deletion packages/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 3fbea4e

Please sign in to comment.