Skip to content

Commit f8a3fc2

Browse files
Add support for openSUSE Tumbleweed
Signed-off-by: Ricardo Branco <rbranco@suse.de>
1 parent 0354cc0 commit f8a3fc2

6 files changed

Lines changed: 74 additions & 11 deletions

File tree

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/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 dnf builddep -y /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)