Skip to content

Commit f504b8f

Browse files
Build for CentOS 9.
Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
1 parent 015bb44 commit f504b8f

5 files changed

Lines changed: 53 additions & 11 deletions

File tree

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME
55
def pkgs = [
66
[target: "centos-7", image: "centos:7", arches: ["amd64", "aarch64"]], // (EOL: June 30, 2024)
77
[target: "centos-8", image: "quay.io/centos/centos:stream8", arches: ["amd64", "aarch64"]],
8+
[target: "centos-9", image: "quay.io/centos/centos:stream9", arches: ["amd64", "aarch64"]],
89
[target: "debian-buster", image: "debian:buster", arches: ["amd64", "aarch64", "armhf"]], // Debian 10 (EOL: 2024)
910
[target: "debian-bullseye", image: "debian:bullseye", arches: ["amd64", "aarch64", "armhf"]], // Debian 11 (Next stable)
1011
[target: "fedora-34", image: "fedora:34", arches: ["amd64", "aarch64"]], // EOL: May 17, 2022

rpm/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ RUN?=docker run --rm \
5757
rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS)
5858

5959
FEDORA_RELEASES ?= fedora-36 fedora-35 fedora-34
60-
CENTOS_RELEASES ?= centos-7 centos-8
60+
CENTOS_RELEASES ?= centos-7 centos-8 centos-9
6161
ifeq ($(ARCH),s390x)
6262
RHEL_RELEASES ?= rhel-7
6363
else
@@ -83,8 +83,8 @@ rpm: fedora centos ## build all rpm packages
8383
.PHONY: fedora
8484
fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages
8585

86-
.PHONY: centos-8
87-
centos-8: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1'
86+
.PHONY: centos-8 centos-9
87+
centos-8 centos-9: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1'
8888

8989
.PHONY: centos
9090
centos: $(CENTOS_RELEASES) ## build all centos rpm packages

rpm/SPECS/docker-ce.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ Requires: container-selinux >= 2:2.74
2222
Requires: libseccomp >= 2.3
2323
Requires: systemd
2424
Requires: iptables
25+
%if %{undefined rhel} || 0%{?rhel} < 9
26+
# Libcgroup is no longer available in RHEL/CentOS >= 9 distros.
2527
Requires: libcgroup
28+
%endif
2629
Requires: containerd.io >= 1.4.1
2730
Requires: tar
2831
Requires: xz

rpm/centos-8/Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,23 @@ ARG SUITE
1818
ENV DISTRO=${DISTRO}
1919
ENV SUITE=${SUITE}
2020

21-
# In aarch64 (arm64) images, the altarch repo is specified as repository, but
22-
# failing, so replace the URL.
23-
RUN if [ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ]; then sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo; fi
24-
2521
RUN if [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ]; then sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo; fi
2622

2723
# RHEL8 / CentOS 8 changed behavior and no longer "rpm --import" or
2824
# "rpmkeys --import"as part of rpm package's %post scriplet. See
2925
# https://forums.centos.org/viewtopic.php?f=54&t=72574, and
3026
# https://access.redhat.com/solutions/3720351
3127
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
32-
RUN yum install -y rpm-build rpmlint yum-utils
28+
RUN dnf install -y rpm-build rpmlint dnf-plugins-core
3329
COPY SPECS /root/rpmbuild/SPECS
3430

3531
# TODO change once we support scan-plugin on other architectures
3632
RUN \
3733
if [ "$(uname -m)" = "x86_64" ]; then \
38-
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
34+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
3935
else \
40-
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \
41-
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \
36+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \
37+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \
4238
fi
4339

4440
COPY --from=golang /usr/local/go /usr/local/go

rpm/centos-9/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ARG GO_IMAGE
2+
ARG DISTRO=centos
3+
ARG SUITE=9
4+
ARG BUILD_IMAGE=quay.io/centos/${DISTRO}:stream${SUITE}
5+
6+
FROM ${GO_IMAGE} AS golang
7+
8+
FROM ${BUILD_IMAGE}
9+
ENV GOPROXY=direct
10+
ENV GO111MODULE=off
11+
ENV GOPATH=/go
12+
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
13+
ENV AUTO_GOPATH 1
14+
ENV DOCKER_BUILDTAGS exclude_graphdriver_btrfs seccomp selinux
15+
ENV RUNC_BUILDTAGS seccomp selinux
16+
ARG DISTRO
17+
ARG SUITE
18+
ENV DISTRO=${DISTRO}
19+
ENV SUITE=${SUITE}
20+
21+
# RHEL8 / CentOS 8 changed behavior and no longer "rpm --import" or
22+
# "rpmkeys --import"as part of rpm package's %post scriplet. See
23+
# https://forums.centos.org/viewtopic.php?f=54&t=72574, and
24+
# https://access.redhat.com/solutions/3720351
25+
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
26+
RUN dnf install -y rpm-build rpmlint dnf-plugins-core
27+
RUN dnf config-manager --set-enabled crb
28+
29+
COPY SPECS /root/rpmbuild/SPECS
30+
31+
# TODO change once we support scan-plugin on other architectures
32+
RUN \
33+
if [ "$(uname -m)" = "x86_64" ]; then \
34+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
35+
else \
36+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \
37+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \
38+
fi
39+
40+
COPY --from=golang /usr/local/go /usr/local/go
41+
WORKDIR /root/rpmbuild
42+
ENTRYPOINT ["/bin/rpmbuild"]

0 commit comments

Comments
 (0)