From 489ccf578d097b2b06e80d708c4c54a830fcb4c1 Mon Sep 17 00:00:00 2001 From: Robert Sturla Date: Wed, 26 Feb 2025 20:18:44 +0000 Subject: [PATCH 1/3] feat: enable Fedora 42 packaging Enables docker-ce builds for Fedora 42. This will be GA in a couple months, and like usual, has a lifespan of two years. The workarounds required for Go on ARM are still required on this version, so have been left in. The comments are still relevant. Signed-off-by: Robert Sturla --- Jenkinsfile | 3 ++- rpm/Makefile | 2 +- rpm/fedora-42/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 rpm/fedora-42/Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 9ae7b03e9c..6534208029 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,8 @@ def pkgs = [ [target: "debian-bullseye", image: "debian:bullseye", arches: ["amd64", "aarch64", "armhf"]], // Debian 11 (oldstable, EOL: 2024-08-14, EOL (LTS): 2026-08-31) [target: "debian-bookworm", image: "debian:bookworm", arches: ["amd64", "aarch64", "armhf"]], // Debian 12 (stable, EOL: 2026-06-10, EOL (LTS): 2028-06-30) [target: "fedora-40", image: "fedora:40", arches: ["amd64", "aarch64"]], // EOL: May 13, 2025 - [target: "fedora-41", image: "fedora:41", arches: ["amd64", "aarch64"]], // EOL: November, 2025 + [target: "fedora-41", image: "fedora:41", arches: ["amd64", "aarch64"]], // EOL: November 19, 2025 + [target: "fedora-42", image: "fedora:42", arches: ["amd64", "aarch64"]], // EOL: May 13, 2026 [target: "raspbian-bullseye", image: "balenalib/rpi-raspbian:bullseye", arches: ["armhf"]], // Debian/Raspbian 11 (stable) [target: "raspbian-bookworm", image: "balenalib/rpi-raspbian:bookworm", arches: ["armhf"]], // Debian/Raspbian 12 (next stable) [target: "ubuntu-focal", image: "ubuntu:focal", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 20.04 LTS (End of support: April, 2025. EOL: April, 2030) diff --git a/rpm/Makefile b/rpm/Makefile index dcd2edae40..876cd0f24a 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -61,7 +61,7 @@ RUN?=docker run --rm \ $(RUN_FLAGS) \ rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) -FEDORA_RELEASES ?= fedora-40 fedora-41 +FEDORA_RELEASES ?= fedora-40 fedora-41 fedora-42 CENTOS_RELEASES ?= centos-9 centos-10 RHEL_RELEASES ?= rhel-8 rhel-9 diff --git a/rpm/fedora-42/Dockerfile b/rpm/fedora-42/Dockerfile new file mode 100644 index 0000000000..ad695bb2a3 --- /dev/null +++ b/rpm/fedora-42/Dockerfile @@ -0,0 +1,50 @@ +# syntax=docker/dockerfile:1 + +ARG GO_IMAGE=golang:latest +ARG DISTRO=fedora +ARG SUITE=42 +ARG BUILD_IMAGE=${DISTRO}:${SUITE} + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_IMAGE} +ENV GOPROXY=https://proxy.golang.org|direct +ENV GO111MODULE=off +ENV GOPATH=/go +ENV GOTOOLCHAIN=local +ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin +ENV AUTO_GOPATH=1 +ARG DISTRO +ARG SUITE +ENV DISTRO=${DISTRO} +ENV SUITE=${SUITE} +RUN dnf install -y rpm-build dnf-plugins-core +# FIXME(thaJeztah): workaround for building on Fedora 41 and up on arm64 +# +# This is the equivalent of https://github.com/docker/containerd-packaging/pull/390 +# for containerd packages, but unlike for containerd packages, we currently do +# not run into this issue when building docker-ce packages. We're installing +# this as a precaution, but perhaps it's not needed. +# +# go1.21 and up have a patch that enforces the use of ld.gold to work around +# a bug in GNU binutils. See; +# - https://github.com/golang/go/issues/22040. +# - https://github.com/golang/go/commit/cd77738198ffe0c4a1db58352c89f9b2d2a4e85e +# +# Fedora 41 and up has a fixed version of binutils, and no longer requires that +# patch, but may fail without ld.gold installed; +# +# /usr/bin/gcc -Wl,-z,now -Wl,-z,nocopyreloc -fuse-ld=gold -o $WORK/b001/exe/a.out -rdynamic /tmp/go-link-1738353519/go.o /tmp/go-link-1738353519/000000.o /tmp/go-link-1738353519/000001.o /tmp/go-link-1738353519/000002.o /tmp/go-link-1738353519/000003.o /tmp/go-link-1738353519/000004.o /tmp/go-link-1738353519/000005.o /tmp/go-link-1738353519/000006.o /tmp/go-link-1738353519/000007.o /tmp/go-link-1738353519/000008.o /tmp/go-link-1738353519/000009.o /tmp/go-link-1738353519/000010.o /tmp/go-link-1738353519/000011.o /tmp/go-link-1738353519/000012.o /tmp/go-link-1738353519/000013.o /tmp/go-link-1738353519/000014.o /tmp/go-link-1738353519/000015.o /tmp/go-link-1738353519/000016.o /tmp/go-link-1738353519/000017.o /tmp/go-link-1738353519/000018.o /tmp/go-link-1738353519/000019.o /tmp/go-link-1738353519/000020.o /tmp/go-link-1738353519/000021.o /tmp/go-link-1738353519/000022.o /tmp/go-link-1738353519/000023.o /tmp/go-link-1738353519/000024.o -O2 -g -lresolv -O2 -g -lpthread -O2 -g -ldl -O2 -g +# collect2: fatal error: cannot find 'ld' +# +# Fedora's build of Go carries a patch for that, but it's not (yet) in upstream; +# - https://src.fedoraproject.org/rpms/golang/blob/a867bd88a656c1d6e91e7b18bab696dc3fcf1e77/f/0006-Default-to-ld.bfd-on-ARM64.patch +# - https://src.fedoraproject.org/rpms/golang/c/a867bd88a656c1d6e91e7b18bab696dc3fcf1e77?branch=rawhide +# +# As a workaround; install binutils-gold +RUN if [ "$(arch)" = 'aarch64' ]; then dnf -y install binutils-gold; fi +COPY --link SPECS /root/rpmbuild/SPECS +RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec +COPY --link --from=golang /usr/local/go /usr/local/go +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"] From fea785d7d03e513210b841a470bf5d15cb8fb1f3 Mon Sep 17 00:00:00 2001 From: Robert Sturla Date: Fri, 28 Mar 2025 09:36:11 +0000 Subject: [PATCH 2/3] fix: update binutils workaround to match containerd packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł Gronowski Signed-off-by: Robert Sturla --- rpm/fedora-42/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpm/fedora-42/Dockerfile b/rpm/fedora-42/Dockerfile index ad695bb2a3..5863826321 100644 --- a/rpm/fedora-42/Dockerfile +++ b/rpm/fedora-42/Dockerfile @@ -42,7 +42,8 @@ RUN dnf install -y rpm-build dnf-plugins-core # - https://src.fedoraproject.org/rpms/golang/c/a867bd88a656c1d6e91e7b18bab696dc3fcf1e77?branch=rawhide # # As a workaround; install binutils-gold -RUN if [ "$(arch)" = 'aarch64' ]; then dnf -y install binutils-gold; fi +RUN if [ "$(rpm --query --queryformat='%{ARCH}' rpm)" = 'aarch64' ] && ! command -v ld.gold; then dnf -y install binutils-gold; fi + COPY --link SPECS /root/rpmbuild/SPECS RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec COPY --link --from=golang /usr/local/go /usr/local/go From 0770878603e4582ec96b253bd2f08a7463d3eb8d Mon Sep 17 00:00:00 2001 From: Robert Sturla Date: Fri, 28 Mar 2025 09:55:46 +0000 Subject: [PATCH 3/3] chore: build Fedora 42 in GitHub Actions CI Signed-off-by: Robert Sturla --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d71d5bbccc..847f7d0952 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: - ubuntu-jammy - ubuntu-noble - ubuntu-oracular + - fedora-42 steps: - name: Checkout