Skip to content

Commit abbac4e

Browse files
authored
Merge pull request #634 from Romain-Geissler-1A/master
[master] Build for CentOS 9.
2 parents 1705ee0 + 0b469b4 commit abbac4e

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

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
@@ -58,7 +58,7 @@ RUN?=docker run --rm \
5858
rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS)
5959

6060
FEDORA_RELEASES ?= fedora-36 fedora-35 fedora-34
61-
CENTOS_RELEASES ?= centos-7 centos-8
61+
CENTOS_RELEASES ?= centos-7 centos-8 centos-9
6262
ifeq ($(ARCH),s390x)
6363
RHEL_RELEASES ?= rhel-7
6464
else
@@ -84,8 +84,8 @@ rpm: fedora centos ## build all rpm packages
8484
.PHONY: fedora
8585
fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages
8686

87-
.PHONY: centos-8
88-
centos-8: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1'
87+
.PHONY: centos-8 centos-9
88+
centos-8 centos-9: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1'
8989

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

rpm/SPECS/docker-ce.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
%global debug_package %{nil}
22

33
# BTRFS is enabled by default, but can be disabled by defining _without_btrfs
4-
%{!?_with_btrfs: %{!?_without_btrfs: %define _with_btrfs 1}}
4+
%if %{undefined _with_btrfs} && %{undefined _without_btrfs}
5+
%define _with_btrfs 1
6+
%endif
57

68
Name: docker-ce
79
Version: %{_version}
@@ -22,7 +24,10 @@ Requires: container-selinux >= 2:2.74
2224
Requires: libseccomp >= 2.3
2325
Requires: systemd
2426
Requires: iptables
27+
%if %{undefined rhel} || 0%{?rhel} < 9
28+
# Libcgroup is no longer available in RHEL/CentOS >= 9 distros.
2529
Requires: libcgroup
30+
%endif
2631
Requires: containerd.io >= 1.4.1
2732
Requires: tar
2833
Requires: xz

rpm/centos-8/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ RUN if [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ]; then sed -i 's/ena
2929
# https://forums.centos.org/viewtopic.php?f=54&t=72574, and
3030
# https://access.redhat.com/solutions/3720351
3131
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
32-
RUN yum install -y rpm-build rpmlint yum-utils
32+
RUN dnf install -y rpm-build rpmlint dnf-plugins-core
3333
COPY SPECS /root/rpmbuild/SPECS
3434

3535
# TODO change once we support scan-plugin on other architectures
3636
RUN \
3737
if [ "$(uname -m)" = "x86_64" ]; then \
38-
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
38+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
3939
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; \
40+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \
41+
dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \
4242
fi
4343

4444
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)