Skip to content

Commit 43d4b6a

Browse files
Add support for openSUSE Tumbleweed
Signed-off-by: Ricardo Branco <[email protected]>
1 parent 0354cc0 commit 43d4b6a

File tree

7 files changed

+80
-13
lines changed

7 files changed

+80
-13
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ clean: clean-src ## remove build artifacts
8282
deb rpm: checkout ## build rpm/deb packages
8383
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@
8484

85-
.PHONY: centos-% fedora-% rhel-%
86-
centos-% fedora-% rhel-%: checkout ## build rpm packages for the specified distro
85+
.PHONY: centos-% fedora-% rhel-% opensuse-%
86+
centos-% fedora-% rhel-% opensuse-%: checkout ## build rpm packages for the specified distro
8787
$(MAKE) -C rpm VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@
8888

8989
.PHONY: debian-% raspbian-% ubuntu-%

distros.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,15 @@
141141
"description": "Red Hat Enterprise Linux 10",
142142
"end_of_life": "05-2035",
143143
"end_of_support": "05-2030"
144+
},
145+
"opensuse-tumbleweed": {
146+
"image": "registry.opensuse.org/opensuse/tumbleweed",
147+
"arches": [
148+
"amd64",
149+
"aarch64"
150+
],
151+
"description": "openSUSE Tumbleweed",
152+
"end_of_life": "12-2100",
153+
"end_of_life": "12-2100"
144154
}
145155
}

install-containerd-helpers

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ function install_rpm_containerd() {
2424
# so this logic works for both cases.
2525
# (See also same logic in install_debian_containerd)
2626

27-
if command -v dnf5; then
27+
if command -v zypper > /dev/null 2>&1; then
28+
# openSUSE/SUSE uses zypper
29+
zypper --version
30+
31+
zypper addrepo "${REPO_URL}" docker-ce
32+
zypper --gpg-auto-import-keys refresh docker-ce
33+
# Enable only the test repository
34+
zypper modifyrepo --disable 'docker-ce-*'
35+
zypper modifyrepo --enable 'docker-ce-test'
36+
zypper refresh
37+
elif command -v dnf5; then
2838
dnf --version
2939

3040
# FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603

rpm/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ RUN?=docker run --rm \
6767
FEDORA_RELEASES ?= fedora-41 fedora-42 fedora-43
6868
CENTOS_RELEASES ?= centos-9 centos-10
6969
RHEL_RELEASES ?= rhel-8 rhel-9 rhel-10
70+
OPENSUSE_RELEASES ?= opensuse-tumbleweed
7071

71-
DISTROS := $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(RHEL_RELEASES)
72+
DISTROS := $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(RHEL_RELEASES) $(OPENSUSE_RELEASES)
7273
BUNDLES := $(patsubst %,rpmbuild/bundles-ce-%-$(DPKG_ARCH).tar.gz,$(DISTROS))
7374

7475
.PHONY: help
@@ -82,7 +83,7 @@ clean: ## remove build artifacts
8283
-docker builder prune -f --filter until=24h
8384

8485
.PHONY: rpm
85-
rpm: fedora centos ## build all rpm packages
86+
rpm: fedora centos opensuse ## build all rpm packages
8687

8788
.PHONY: fedora
8889
fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages
@@ -98,6 +99,9 @@ rhel: $(RHEL_RELEASES) ## build all rhel rpm packages
9899
# each of the rhel-*/Dockerfile files.
99100
$(RHEL_RELEASES): RPMBUILD_EXTRA_FLAGS += --define '_no_libnftables true'
100101

102+
.PHONY: opensuse
103+
opensuse: $(OPENSUSE_RELEASES) ## build all opensuse rpm packages
104+
101105
.PHONY: $(DISTROS)
102106
$(DISTROS): sources
103107
@echo "== Building packages for $@ =="

rpm/SPECS/docker-ce.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ Requires: (iptables-nft or iptables)
2323
Requires: nftables
2424
%if %{undefined rhel} || 0%{?rhel} < 9
2525
# Libcgroup is no longer available in RHEL/CentOS >= 9 distros.
26+
%if 0%{?suse_version}
27+
Requires: libcgroup3
28+
%else
2629
Requires: libcgroup
2730
%endif
31+
%endif
2832
Requires: containerd.io >= 1.7.27
2933
Requires: tar
3034
Requires: xz

rpm/opensuse-tumbleweed/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# syntax=docker/dockerfile:1
2+
3+
ARG GO_IMAGE=golang:latest
4+
ARG DISTRO=opensuse
5+
ARG SUITE=tumbleweed
6+
ARG BUILD_IMAGE=registry.opensuse.org/${DISTRO}/${SUITE}
7+
8+
FROM ${GO_IMAGE} AS golang
9+
10+
FROM ${BUILD_IMAGE}
11+
ENV GOPROXY=https://proxy.golang.org|direct
12+
ENV GO111MODULE=on
13+
ENV GOPATH=/go
14+
ENV GOTOOLCHAIN=local
15+
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
16+
ENV AUTO_GOPATH=1
17+
ARG DISTRO
18+
ARG SUITE
19+
ENV DISTRO=${DISTRO}
20+
ENV SUITE=${SUITE}
21+
RUN zypper install -y rpm-build
22+
23+
COPY --link SPECS /root/rpmbuild/SPECS
24+
RUN zypper -n install -y --force-resolution $(rpmspec -q --buildrequires /root/rpmbuild/SPECS/*.spec)
25+
COPY --link --from=golang /usr/local/go /usr/local/go
26+
WORKDIR /root/rpmbuild
27+
ENTRYPOINT ["/bin/rpmbuild"]

verify

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,23 @@ function verify_rpm() {
112112
DIST_ID=$(. /etc/os-release; echo "${ID}")
113113
DIST_VERSION=$(. /etc/os-release; echo "${VERSION_ID}" | cut -d'.' -f1)
114114

115-
pkg_manager="yum"
116-
pkg_config_manager="yum-config-manager"
117-
if dnf --version; then
118-
pkg_manager="dnf"
119-
pkg_config_manager="dnf config-manager"
120-
dnf clean all
121-
${pkg_manager} install -y 'dnf-command(config-manager)'
122-
fi
115+
case ${DIST_ID} in
116+
opensuse-tumbleweed)
117+
pkg_manager="zypper"
118+
DIST_VERSION="tumbleweed"
119+
zypper clean -a
120+
;;
121+
*)
122+
pkg_manager="yum"
123+
pkg_config_manager="yum-config-manager"
124+
if dnf --version; then
125+
pkg_manager="dnf"
126+
pkg_config_manager="dnf config-manager"
127+
dnf clean all
128+
${pkg_manager} install -y 'dnf-command(config-manager)'
129+
fi
130+
;;
131+
esac
123132

124133
case ${DIST_ID}:${DIST_VERSION} in
125134
ol:7*)
@@ -129,6 +138,9 @@ function verify_rpm() {
129138
fedora*)
130139
dnf install -y findutils
131140
;;
141+
opensuse*)
142+
zypper install -y findutils
143+
;;
132144
esac
133145

134146
install_rpm_containerd

0 commit comments

Comments
 (0)