From 8093ec8ae1d938dfd848f61a3f50b2fba83d11d8 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 19 Sep 2022 14:40:03 +0200 Subject: [PATCH 01/11] bump to bullseye as go image variant (missing platforms with buster) Signed-off-by: CrazyMax --- common/vars.mk | 2 +- pkg/containerd/Dockerfile | 2 +- pkg/credential-helpers/Dockerfile | 2 +- pkg/docker-cli/Dockerfile | 2 +- pkg/docker-engine/Dockerfile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/vars.mk b/common/vars.mk index ced52d23..4619b9cd 100644 --- a/common/vars.mk +++ b/common/vars.mk @@ -15,7 +15,7 @@ export BASEDIR ?= $(CURDIR) export GO_IMAGE ?= golang export GO_VERSION ?= 1.18.5 -export GO_IMAGE_VARIANT ?= buster +export GO_IMAGE_VARIANT ?= bullseye export PKG_VENDOR ?= Docker export PKG_PACKAGER ?= Docker diff --git a/pkg/containerd/Dockerfile b/pkg/containerd/Dockerfile index 10d4b6ba..aaaa6c90 100644 --- a/pkg/containerd/Dockerfile +++ b/pkg/containerd/Dockerfile @@ -24,7 +24,7 @@ ARG RUNC_REPO="https://github.com/opencontainers/runc.git" # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" -ARG GO_IMAGE_VARIANT="buster" +ARG GO_IMAGE_VARIANT="bullseye" # pkg matrix ARG PKG_RELEASE="debian11" diff --git a/pkg/credential-helpers/Dockerfile b/pkg/credential-helpers/Dockerfile index d7f8606d..72079bb7 100644 --- a/pkg/credential-helpers/Dockerfile +++ b/pkg/credential-helpers/Dockerfile @@ -22,7 +22,7 @@ ARG DEBIAN_FRONTEND="noninteractive" # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" -ARG GO_IMAGE_VARIANT="buster" +ARG GO_IMAGE_VARIANT="bullseye" # pkg matrix ARG PKG_RELEASE="debian11" diff --git a/pkg/docker-cli/Dockerfile b/pkg/docker-cli/Dockerfile index 4258ab43..17052145 100644 --- a/pkg/docker-cli/Dockerfile +++ b/pkg/docker-cli/Dockerfile @@ -21,7 +21,7 @@ ARG DEBIAN_FRONTEND="noninteractive" # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" -ARG GO_IMAGE_VARIANT="buster" +ARG GO_IMAGE_VARIANT="bullseye" # pkg matrix ARG PKG_RELEASE="debian11" diff --git a/pkg/docker-engine/Dockerfile b/pkg/docker-engine/Dockerfile index 221f4296..684e7b97 100644 --- a/pkg/docker-engine/Dockerfile +++ b/pkg/docker-engine/Dockerfile @@ -21,7 +21,7 @@ ARG DEBIAN_FRONTEND="noninteractive" # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" -ARG GO_IMAGE_VARIANT="buster" +ARG GO_IMAGE_VARIANT="bullseye" # pkg matrix ARG PKG_RELEASE="debian11" From ad2cb6ecba3f25a355a9ea7180bddef457c13bbb Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 13:28:41 +0200 Subject: [PATCH 02/11] common: evaluate compat platforms of target pkg with project ones evaluating compatible platforms of target package with ones provided by each project. if PKG_SUPPORTED_PLATFORMS is empty, we assume we want to build all platforms supported by the project (static pkg) Signed-off-by: CrazyMax --- common/build.mk | 10 ++++++---- common/packages.mk | 49 +++++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/common/build.mk b/common/build.mk index 0d8d8dad..0ec80cd4 100644 --- a/common/build.mk +++ b/common/build.mk @@ -13,9 +13,11 @@ # limitations under the License. define run_bake - @PKG_RELEASE=$(1) DESTDIR=$(2) docker buildx bake $(3) $(4) --print $(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX)) - PKG_RELEASE=$(1) DESTDIR=$($@_TMP_OUT) docker buildx bake $(3) $(4) + $(eval FILTERED_PLATFORMS = $(filter $(PKG_SUPPORTED_PLATFORMS),$(4))) + $(eval PLATFORMS = $(if $(PKG_SUPPORTED_PLATFORMS:-=),$(FILTERED_PLATFORMS),$(4))) + @PKG_RELEASE=$(1) DESTDIR=$(2) docker buildx bake $(foreach platform,$(PLATFORMS),--set "*.platform=$(platform)") $(3) pkg --print + PKG_RELEASE=$(1) DESTDIR=$($@_TMP_OUT) docker buildx bake $(foreach platform,$(PLATFORMS),--set "*.platform=$(platform)") $(3) pkg mkdir -p $(2) find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(2)/ ';' find $(2) -type d -empty -delete @@ -48,8 +50,8 @@ pkg-multi-static: .PHONY: build-% build-%: pkg-info-% - $(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg) + $(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),) .PHONY: build-multi-% build-multi-%: pkg-info-% - $(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg-multi) + $(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),$(PKG_PLATFORMS)) diff --git a/common/packages.mk b/common/packages.mk index 6d0c8b55..3387a43a 100644 --- a/common/packages.mk +++ b/common/packages.mk @@ -18,6 +18,9 @@ PKG_APK_RELEASES ?= alpine314 alpine315 alpine316 PKG_DEB_RELEASES ?= debian10 debian11 ubuntu1804 ubuntu2004 ubuntu2204 raspbian10 raspbian11 PKG_RPM_RELEASES ?= centos7 centos8 centos9 fedora35 fedora36 fedora37 oraclelinux7 oraclelinux8 oraclelinux9 +# PKG_SUPPORTED_PLATFORMS could be replaced by: +# docker buildx imagetools inspect centos:7 --format "{{json .Manifest}}" | jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)/\(.platform.variant)"' | sed 's#/null$##' | tr '\n' ',' | sed 's#,$##' + .PHONY: pkg-apk-releases pkg-apk-releases: $(eval PKG_RELEASES = $(PKG_APK_RELEASES)) @@ -36,7 +39,7 @@ pkg-info-alpine314: $(eval PKG_DISTRO = alpine) $(eval PKG_SUITE = 3.14) $(eval PKG_BASE_IMAGE = alpine:3.14) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l armv6l armv5l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6 linux/arm/v5 linux/ppc64le linux/s390x) .PHONY: pkg-info-alpine315 pkg-info-alpine315: @@ -44,7 +47,7 @@ pkg-info-alpine315: $(eval PKG_DISTRO = alpine) $(eval PKG_SUITE = 3.15) $(eval PKG_BASE_IMAGE = alpine:3.15) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l armv6l armv5l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6 linux/arm/v5 linux/ppc64le linux/s390x) .PHONY: pkg-info-alpine316 pkg-info-alpine316: @@ -52,7 +55,7 @@ pkg-info-alpine316: $(eval PKG_DISTRO = alpine) $(eval PKG_SUITE = 3.16) $(eval PKG_BASE_IMAGE = alpine:3.16) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l armv6l armv5l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6 linux/arm/v5 linux/ppc64le linux/s390x) .PHONY: pkg-info-debian10 pkg-info-debian10: @@ -60,7 +63,7 @@ pkg-info-debian10: $(eval PKG_DISTRO = debian) $(eval PKG_SUITE = buster) $(eval PKG_BASE_IMAGE = debian:buster) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l armv6l ppc64le riscv64 s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v7) .PHONY: pkg-info-debian11 pkg-info-debian11: @@ -68,23 +71,23 @@ pkg-info-debian11: $(eval PKG_DISTRO = debian) $(eval PKG_SUITE = bullseye) $(eval PKG_BASE_IMAGE = debian:bullseye) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l armv6l ppc64le riscv64 s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/mips64le linux/ppc64le linux/s390x) .PHONY: pkg-info-raspbian10 pkg-info-raspbian10: $(eval PKG_TYPE = deb) $(eval PKG_DISTRO = raspbian) $(eval PKG_SUITE = buster) - $(eval PKG_BASE_IMAGE = raspbian:buster) - $(eval PKG_SUPPORTED_ARCHS = armv6l) + $(eval PKG_BASE_IMAGE = balenalib/rpi-raspbian:buster) + $(eval PKG_SUPPORTED_PLATFORMS = linux/arm/v7) .PHONY: pkg-info-raspbian11 pkg-info-raspbian11: $(eval PKG_TYPE = deb) $(eval PKG_DISTRO = raspbian) $(eval PKG_SUITE = bullseye) - $(eval PKG_BASE_IMAGE = raspbian:bullseye) - $(eval PKG_SUPPORTED_ARCHS = armv6l) + $(eval PKG_BASE_IMAGE = balenalib/rpi-raspbian:bullseye) + $(eval PKG_SUPPORTED_PLATFORMS = linux/arm/v7) .PHONY: pkg-info-ubuntu1804 pkg-info-ubuntu1804: @@ -92,7 +95,7 @@ pkg-info-ubuntu1804: $(eval PKG_DISTRO = ubuntu) $(eval PKG_SUITE = bionic) $(eval PKG_BASE_IMAGE = ubuntu:bionic) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/arm/v7 linux/ppc64le linux/s390x) .PHONY: pkg-info-ubuntu2004 pkg-info-ubuntu2004: @@ -100,7 +103,7 @@ pkg-info-ubuntu2004: $(eval PKG_DISTRO = ubuntu) $(eval PKG_SUITE = focal) $(eval PKG_BASE_IMAGE = ubuntu:focal) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64 armv7l ppc64le riscv64 s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/arm/v7 linux/ppc64le linux/riscv64 linux/s390x) .PHONY: pkg-info-ubuntu2204 pkg-info-ubuntu2204: @@ -108,7 +111,7 @@ pkg-info-ubuntu2204: $(eval PKG_DISTRO = ubuntu) $(eval PKG_SUITE = jammy) $(eval PKG_BASE_IMAGE = ubuntu:jammy) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64 armv7l ppc64le riscv64 s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/arm/v7 linux/ppc64le linux/riscv64 linux/s390x) .PHONY: pkg-info-centos7 pkg-info-centos7: @@ -116,7 +119,8 @@ pkg-info-centos7: $(eval PKG_DISTRO = centos) $(eval PKG_SUITE = 7) $(eval PKG_BASE_IMAGE = centos:7) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 armv7l ppc64le) + @# FIXME: packages look broken for linux/arm/v7 on centos:7 + $(eval PKG_SUPPORTED_PLATFORMS = linux/386 linux/amd64 linux/arm64 linux/ppc64le) .PHONY: pkg-info-centos8 pkg-info-centos8: @@ -124,7 +128,7 @@ pkg-info-centos8: $(eval PKG_DISTRO = centos) $(eval PKG_SUITE = 8) $(eval PKG_BASE_IMAGE = quay.io/centos/centos:stream8) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 ppc64le) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/ppc64le) .PHONY: pkg-info-centos9 pkg-info-centos9: @@ -132,7 +136,8 @@ pkg-info-centos9: $(eval PKG_DISTRO = centos) $(eval PKG_SUITE = 9) $(eval PKG_BASE_IMAGE = quay.io/centos/centos:stream9) - $(eval PKG_SUPPORTED_ARCHS = i386 x86_64 aarch64 arm64 ppc64le s390x) + @# FIXME: packages look broken for linux/s390x on centos:stream9 + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/ppc64le) .PHONY: pkg-info-fedora35 pkg-info-fedora35: @@ -140,7 +145,7 @@ pkg-info-fedora35: $(eval PKG_DISTRO = fedora) $(eval PKG_SUITE = 35) $(eval PKG_BASE_IMAGE = fedora:35) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64 armv7l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/ppc64le linux/s390x) .PHONY: pkg-info-fedora36 pkg-info-fedora36: @@ -148,7 +153,7 @@ pkg-info-fedora36: $(eval PKG_DISTRO = fedora) $(eval PKG_SUITE = 36) $(eval PKG_BASE_IMAGE = fedora:36) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64 armv7l ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/ppc64le linux/s390x) .PHONY: pkg-info-fedora37 pkg-info-fedora37: @@ -156,7 +161,7 @@ pkg-info-fedora37: $(eval PKG_DISTRO = fedora) $(eval PKG_SUITE = 37) $(eval PKG_BASE_IMAGE = fedora:37) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64 ppc64le s390x) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64 linux/ppc64le linux/s390x) .PHONY: pkg-info-oraclelinux7 pkg-info-oraclelinux7: @@ -164,7 +169,7 @@ pkg-info-oraclelinux7: $(eval PKG_DISTRO = oraclelinux) $(eval PKG_SUITE = 7) $(eval PKG_BASE_IMAGE = oraclelinux:7) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64) .PHONY: pkg-info-oraclelinux8 pkg-info-oraclelinux8: @@ -172,7 +177,7 @@ pkg-info-oraclelinux8: $(eval PKG_DISTRO = oraclelinux) $(eval PKG_SUITE = 8) $(eval PKG_BASE_IMAGE = oraclelinux:8) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64) .PHONY: pkg-info-oraclelinux9 pkg-info-oraclelinux9: @@ -180,7 +185,7 @@ pkg-info-oraclelinux9: $(eval PKG_DISTRO = oraclelinux) $(eval PKG_SUITE = 9) $(eval PKG_BASE_IMAGE = oraclelinux:9) - $(eval PKG_SUPPORTED_ARCHS = x86_64 aarch64 arm64) + $(eval PKG_SUPPORTED_PLATFORMS = linux/amd64 linux/arm64) .PHONY: pkg-info-static pkg-info-static: @@ -188,4 +193,4 @@ pkg-info-static: $(eval PKG_DISTRO = static) $(eval PKG_SUITE =) $(eval PKG_BASE_IMAGE = debian:bullseye) - $(eval PKG_SUPPORTED_ARCHS =) + $(eval PKG_SUPPORTED_PLATFORMS =) From 05606e1ba420e35ca546655d7c397a820596d81f Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 15:33:19 +0200 Subject: [PATCH 03/11] pkg(docker-cli): multi arch support and bump to v22.06.0-beta.0 Signed-off-by: CrazyMax --- common/vars.mk | 2 +- pkg/docker-cli/Dockerfile | 26 +++++++++---- pkg/docker-cli/Makefile | 9 +++-- pkg/docker-cli/docker-bake.hcl | 41 ++++++++------------ pkg/docker-cli/internal/pkg-deb-build.sh | 10 ++--- pkg/docker-cli/internal/pkg-deb-builddeps.sh | 8 +--- pkg/docker-cli/internal/pkg-deb-init.sh | 6 --- pkg/docker-cli/internal/pkg-rpm-build.sh | 15 +++---- pkg/docker-cli/internal/pkg-rpm-builddeps.sh | 21 +++++----- pkg/docker-cli/internal/pkg-rpm-init.sh | 18 +++------ pkg/docker-cli/internal/pkg-static-build.sh | 6 --- pkg/docker-cli/rpm/docker-ce-cli.spec | 1 + 12 files changed, 70 insertions(+), 93 deletions(-) diff --git a/common/vars.mk b/common/vars.mk index 4619b9cd..e27a56ad 100644 --- a/common/vars.mk +++ b/common/vars.mk @@ -54,7 +54,7 @@ export SCAN_REPO ?= https://github.com/docker/scan-cli-plugin.git export CREDENTIAL_HELPERS_REPO ?= https://github.com/docker/docker-credential-helpers.git export DOCKER_ENGINE_VERSION ?= v20.10.17 -export DOCKER_CLI_VERSION ?= v20.10.17 +export DOCKER_CLI_VERSION ?= v22.06.0-beta.0 export CONTAINERD_VERSION ?= v1.6.8 export BUILDX_VERSION ?= v0.9.1 export COMPOSE_VERSION ?= v2.10.2 diff --git a/pkg/docker-cli/Dockerfile b/pkg/docker-cli/Dockerfile index 17052145..f1491e53 100644 --- a/pkg/docker-cli/Dockerfile +++ b/pkg/docker-cli/Dockerfile @@ -18,6 +18,9 @@ ARG XX_VERSION="1.1.2" ARG ALPINE_VERSION="3.16" ARG DEBIAN_FRONTEND="noninteractive" +# specific to docker-cli +ARG GOVERSIONINFO_VERSION="v1.3.0" + # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" @@ -46,7 +49,7 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM dockercore/golang-cross:xx-sdk-extras AS osxsdk # go base image to retrieve /usr/local/go -FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go +FROM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go # dummy stage for unsupported platforms FROM --platform=$BUILDPLATFORM busybox AS builder-dummy @@ -70,7 +73,7 @@ RUN --mount=from=src,source=/src,target=/cli \ mkdir /out && tar -C / -zcf /out/cli.tgz --exclude .git cli # deb -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-deb +FROM ${PKG_BASE_IMAGE} AS build-base-deb COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y apt-utils bash curl devscripts equivs git @@ -109,7 +112,7 @@ FROM build-dummy AS builder-deb-windows FROM builder-deb-${TARGETOS} AS builder-deb # rpm -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-rpm +FROM ${PKG_BASE_IMAGE} AS build-base-rpm COPY --from=xx / / ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" @@ -146,10 +149,11 @@ FROM build-dummy AS builder-rpm-windows FROM builder-rpm-${TARGETOS} AS builder-rpm # static +FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS gocross FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-static COPY --from=xx / / ARG DEBIAN_FRONTEND -RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm pkg-config +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates clang dpkg-dev file git llvm pkg-config ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" @@ -157,6 +161,13 @@ ENV CGO_ENABLED="1" ARG TARGETPLATFORM RUN xx-apt-get install -y binutils gcc libc6-dev libgcc-10-dev pkg-config +FROM build-base-static AS goversioninfo +ARG GOVERSIONINFO_VERSION +RUN --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + GOBIN=/out GO111MODULE=on go install "github.com/josephspurrier/goversioninfo/cmd/goversioninfo@${GOVERSIONINFO_VERSION}" + FROM build-base-static AS build-static ARG TARGETPLATFORM ARG DOCKER_CLI_VERSION @@ -166,16 +177,17 @@ ARG GO_STRIP ARG CGO_ENABLED WORKDIR /go/src/github.com/docker/cli RUN --mount=type=bind,from=src,source=/src,target=.,rw \ - --mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=goversioninfo,source=/out/goversioninfo,target=/usr/bin/goversioninfo \ --mount=from=osxsdk,target=/xx-sdk,src=/xx-sdk \ --mount=type=tmpfs,target=cli/winresources \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod < /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - tilde='~' debVersion="${DOCKER_CLI_VERSION#v}" debVersion="${debVersion//-/$tilde}" @@ -68,10 +62,12 @@ if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse HEAD)" fi +xx-go --wrap + set -x chmod -x debian/compat debian/control debian/docs debian/*.bash-completion debian/*.manpages -DOCKER_CLI_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS +DOCKER_CLI_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS --host-arch $(xx-info debian-arch) --target-arch $(xx-info debian-arch) pkgoutput="${OUTDIR}/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then diff --git a/pkg/docker-cli/internal/pkg-deb-builddeps.sh b/pkg/docker-cli/internal/pkg-deb-builddeps.sh index 9ee9afa0..a7e205e9 100755 --- a/pkg/docker-cli/internal/pkg-deb-builddeps.sh +++ b/pkg/docker-cli/internal/pkg-deb-builddeps.sh @@ -21,12 +21,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control +mk-build-deps -t "xx-apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control diff --git a/pkg/docker-cli/internal/pkg-deb-init.sh b/pkg/docker-cli/internal/pkg-deb-init.sh index c6969954..6804e832 100755 --- a/pkg/docker-cli/internal/pkg-deb-init.sh +++ b/pkg/docker-cli/internal/pkg-deb-init.sh @@ -28,12 +28,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in diff --git a/pkg/docker-cli/internal/pkg-rpm-build.sh b/pkg/docker-cli/internal/pkg-rpm-build.sh index f19d18f5..0b54cc09 100755 --- a/pkg/docker-cli/internal/pkg-rpm-build.sh +++ b/pkg/docker-cli/internal/pkg-rpm-build.sh @@ -47,18 +47,19 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse HEAD)" fi +xx-go --wrap + set -x +# FIXME: CC is set to a cross package: https://github.com/docker/packaging/pull/25#issuecomment-1256594482 +if ! command "$(go env CC)" &> /dev/null; then + go env -w CC=gcc +fi + tilde='~' rpmVersion="${DOCKER_CLI_VERSION#v}" rpmVersion="${rpmVersion//-/$tilde}" @@ -74,7 +75,7 @@ if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" fi -rpmbuild $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec +rpmbuild --target $(xx-info rhel-arch) $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec mkdir -p "${pkgoutput}" cp ./RPMS/*/*.* "${pkgoutput}"/ if [ "$(ls -A ./SRPMS)" ]; then diff --git a/pkg/docker-cli/internal/pkg-rpm-builddeps.sh b/pkg/docker-cli/internal/pkg-rpm-builddeps.sh index 84574b71..f16c885c 100755 --- a/pkg/docker-cli/internal/pkg-rpm-builddeps.sh +++ b/pkg/docker-cli/internal/pkg-rpm-builddeps.sh @@ -21,19 +21,16 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - -set -x - -if command -v yum-builddep &> /dev/null; then - yum-builddep -y /root/rpmbuild/SPECS/*.spec -elif command -v dnf &> /dev/null; then - dnf builddep -y /root/rpmbuild/SPECS/*.spec +builddepCmd="" +if command -v dnf &> /dev/null; then + builddepCmd="setarch $(xx-info rhel-arch) dnf builddep" +elif command -v yum-builddep &> /dev/null; then + builddepCmd="yum-builddep --target $(xx-info rhel-arch)" else echo >&2 "unable to detect package manager" exit 1 fi + +set -x + +$builddepCmd -y /root/rpmbuild/SPECS/*.spec diff --git a/pkg/docker-cli/internal/pkg-rpm-init.sh b/pkg/docker-cli/internal/pkg-rpm-init.sh index a467177e..1da29f0e 100755 --- a/pkg/docker-cli/internal/pkg-rpm-init.sh +++ b/pkg/docker-cli/internal/pkg-rpm-init.sh @@ -28,41 +28,35 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in centos7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release ;; centos8) [ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ] && sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release ;; centos9) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release dnf config-manager --set-enabled crb ;; oraclelinux7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release yum-config-manager --enable ol7_addons --enable ol7_optional_latest ;; oraclelinux8) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol8_addons --enable ol8_codeready_builder ;; oraclelinux9) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol9_addons --enable ol9_codeready_builder ;; fedora*) diff --git a/pkg/docker-cli/internal/pkg-static-build.sh b/pkg/docker-cli/internal/pkg-static-build.sh index a9f2961f..1103efc0 100755 --- a/pkg/docker-cli/internal/pkg-static-build.sh +++ b/pkg/docker-cli/internal/pkg-static-build.sh @@ -34,12 +34,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - pkgoutput="/out/static/$(xx-info os)/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" diff --git a/pkg/docker-cli/rpm/docker-ce-cli.spec b/pkg/docker-cli/rpm/docker-ce-cli.spec index c62bdd02..5a22f0ae 100644 --- a/pkg/docker-cli/rpm/docker-ce-cli.spec +++ b/pkg/docker-cli/rpm/docker-ce-cli.spec @@ -41,6 +41,7 @@ Recommends: docker-scan-plugin(x86-64) %endif BuildRequires: gcc +BuildRequires: libtool-ltdl-devel BuildRequires: make Conflicts: docker From 6e98c8db7de0caa3f0b6a3bb75f05a60236bd0a1 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 14:38:28 +0200 Subject: [PATCH 04/11] pkg(containerd): multi arch support Signed-off-by: CrazyMax --- pkg/containerd/Dockerfile | 15 ++++---- pkg/containerd/Makefile | 11 ++++-- pkg/containerd/docker-bake.hcl | 36 +++++++------------- pkg/containerd/internal/pkg-deb-build.sh | 10 ++---- pkg/containerd/internal/pkg-deb-builddeps.sh | 8 +---- pkg/containerd/internal/pkg-rpm-build.sh | 15 ++++---- pkg/containerd/internal/pkg-rpm-builddeps.sh | 19 +++++------ pkg/containerd/internal/pkg-rpm-init.sh | 18 ++++------ pkg/containerd/internal/pkg-static-build.sh | 6 ---- pkg/containerd/rpm/containerd.spec | 1 + 10 files changed, 57 insertions(+), 82 deletions(-) diff --git a/pkg/containerd/Dockerfile b/pkg/containerd/Dockerfile index aaaa6c90..d3292221 100644 --- a/pkg/containerd/Dockerfile +++ b/pkg/containerd/Dockerfile @@ -46,7 +46,7 @@ ARG PKG_RPM_RELEASE="1" FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx # go base image to retrieve /usr/local/go -FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go +FROM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go # md2man FROM go AS go-md2man @@ -91,7 +91,7 @@ RUN --mount=from=runc-src,source=/src,target=/runc \ mkdir /out && tar -C / -zcf /out/runc.tgz --exclude .git runc # deb -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-deb +FROM ${PKG_BASE_IMAGE} AS build-base-deb COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y apt-utils bash ca-certificates curl devscripts equivs git lsb-release @@ -131,7 +131,7 @@ FROM build-dummy AS builder-deb-windows FROM builder-deb-${TARGETOS} AS builder-deb # rpm -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-rpm +FROM ${PKG_BASE_IMAGE} AS build-base-rpm COPY --from=xx / / ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" @@ -171,10 +171,11 @@ FROM build-dummy AS builder-rpm-windows FROM builder-rpm-${TARGETOS} AS builder-rpm # static +FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS gocross FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-static COPY --from=xx / / ARG DEBIAN_FRONTEND -RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm make pkg-config +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates clang dpkg-dev file git llvm make pkg-config ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" @@ -189,10 +190,11 @@ ARG DOCKER_CLI_VERSION ARG CGO_ENABLED WORKDIR /go/src/github.com/containerd/containerd RUN --mount=type=bind,from=src,source=/src,target=.,rw \ - --mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod < /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse HEAD)" fi +xx-go --wrap + set -x sed 's#/usr/local/bin/containerd#/usr/bin/containerd#g' "${SRCDIR}/containerd.service" > /common/containerd.service chmod -x debian/compat debian/control debian/copyright debian/manpages -GO_SRC_PATH=${GOPATH}/src/github.com/containerd/containerd CONTAINERD_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS +GO_SRC_PATH=${GOPATH}/src/github.com/containerd/containerd CONTAINERD_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS --host-arch $(xx-info debian-arch) --target-arch $(xx-info debian-arch) pkgoutput="${OUTDIR}/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then diff --git a/pkg/containerd/internal/pkg-deb-builddeps.sh b/pkg/containerd/internal/pkg-deb-builddeps.sh index 9ee9afa0..a7e205e9 100755 --- a/pkg/containerd/internal/pkg-deb-builddeps.sh +++ b/pkg/containerd/internal/pkg-deb-builddeps.sh @@ -21,12 +21,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control +mk-build-deps -t "xx-apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control diff --git a/pkg/containerd/internal/pkg-rpm-build.sh b/pkg/containerd/internal/pkg-rpm-build.sh index b895e0c9..b9484538 100755 --- a/pkg/containerd/internal/pkg-rpm-build.sh +++ b/pkg/containerd/internal/pkg-rpm-build.sh @@ -47,18 +47,19 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse HEAD)" fi +xx-go --wrap + set -x +# FIXME: CC is set to a cross package: https://github.com/docker/packaging/pull/25#issuecomment-1256594482 +if ! command "$(go env CC)" &> /dev/null; then + go env -w CC=gcc +fi + sed 's#/usr/local/bin/containerd#/usr/bin/containerd#g' "${SRCDIR}/containerd.service" > /root/rpmbuild/SOURCES/containerd.service tilde='~' @@ -76,7 +77,7 @@ if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" fi -rpmbuild $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec +rpmbuild --target $(xx-info rhel-arch) $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec mkdir -p "${pkgoutput}" cp ./RPMS/*/*.* "${pkgoutput}"/ if [ "$(ls -A ./SRPMS)" ]; then diff --git a/pkg/containerd/internal/pkg-rpm-builddeps.sh b/pkg/containerd/internal/pkg-rpm-builddeps.sh index 84574b71..32dc10b9 100755 --- a/pkg/containerd/internal/pkg-rpm-builddeps.sh +++ b/pkg/containerd/internal/pkg-rpm-builddeps.sh @@ -21,19 +21,18 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -if command -v yum-builddep &> /dev/null; then - yum-builddep -y /root/rpmbuild/SPECS/*.spec -elif command -v dnf &> /dev/null; then - dnf builddep -y /root/rpmbuild/SPECS/*.spec +builddepCmd="" +if command -v dnf &> /dev/null; then + builddepCmd="setarch $(xx-info rhel-arch) dnf builddep" +elif command -v yum-builddep &> /dev/null; then + builddepCmd="yum-builddep --target $(xx-info rhel-arch)" else echo >&2 "unable to detect package manager" exit 1 fi + +set -x + +$builddepCmd -y /root/rpmbuild/SPECS/*.spec diff --git a/pkg/containerd/internal/pkg-rpm-init.sh b/pkg/containerd/internal/pkg-rpm-init.sh index a467177e..1da29f0e 100755 --- a/pkg/containerd/internal/pkg-rpm-init.sh +++ b/pkg/containerd/internal/pkg-rpm-init.sh @@ -28,41 +28,35 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in centos7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release ;; centos8) [ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ] && sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release ;; centos9) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release dnf config-manager --set-enabled crb ;; oraclelinux7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release yum-config-manager --enable ol7_addons --enable ol7_optional_latest ;; oraclelinux8) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol8_addons --enable ol8_codeready_builder ;; oraclelinux9) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol9_addons --enable ol9_codeready_builder ;; fedora*) diff --git a/pkg/containerd/internal/pkg-static-build.sh b/pkg/containerd/internal/pkg-static-build.sh index 12d6b8a7..d84985f2 100755 --- a/pkg/containerd/internal/pkg-static-build.sh +++ b/pkg/containerd/internal/pkg-static-build.sh @@ -36,12 +36,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - pkgoutput="/out/static/$(xx-info os)/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" diff --git a/pkg/containerd/rpm/containerd.spec b/pkg/containerd/rpm/containerd.spec index dde08804..2301eaf9 100644 --- a/pkg/containerd/rpm/containerd.spec +++ b/pkg/containerd/rpm/containerd.spec @@ -65,6 +65,7 @@ Requires: libseccomp2 %endif BuildRequires: make BuildRequires: gcc +BuildRequires: libtool-ltdl-devel BuildRequires: systemd BuildRequires: libseccomp-devel From 26c85046541c2f20aa7ef513904d8a5af7e0d07a Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 15:32:50 +0200 Subject: [PATCH 05/11] pkg(credential-helpers): multi arch support and bump to v0.7.0 Signed-off-by: CrazyMax --- common/vars.mk | 2 +- pkg/credential-helpers/Dockerfile | 20 +++++---- pkg/credential-helpers/Makefile | 9 ++-- pkg/credential-helpers/docker-bake.hcl | 41 ++++++++----------- .../internal/pkg-deb-build.sh | 10 ++--- .../internal/pkg-deb-builddeps.sh | 8 +--- .../internal/pkg-deb-init.sh | 6 --- .../internal/pkg-rpm-build.sh | 15 +++---- .../internal/pkg-rpm-builddeps.sh | 19 ++++----- .../internal/pkg-rpm-init.sh | 18 +++----- .../internal/pkg-static-build.sh | 6 --- .../rpm/docker-credential-pass.spec | 1 + .../rpm/docker-credential-secretservice.spec | 1 + 13 files changed, 64 insertions(+), 92 deletions(-) diff --git a/common/vars.mk b/common/vars.mk index e27a56ad..e74b1f49 100644 --- a/common/vars.mk +++ b/common/vars.mk @@ -59,4 +59,4 @@ export CONTAINERD_VERSION ?= v1.6.8 export BUILDX_VERSION ?= v0.9.1 export COMPOSE_VERSION ?= v2.10.2 export SCAN_VERSION ?= v0.19.0 -export CREDENTIAL_HELPERS_VERSION ?= v0.7.0-beta.1 +export CREDENTIAL_HELPERS_VERSION ?= v0.7.0 diff --git a/pkg/credential-helpers/Dockerfile b/pkg/credential-helpers/Dockerfile index 72079bb7..b91e8840 100644 --- a/pkg/credential-helpers/Dockerfile +++ b/pkg/credential-helpers/Dockerfile @@ -47,7 +47,7 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross # go base image to retrieve /usr/local/go -FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go +FROM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go # dummy stage for unsupported platforms FROM --platform=$BUILDPLATFORM busybox AS builder-dummy @@ -71,7 +71,7 @@ RUN --mount=from=src,source=/src,target=/docker-credential-helpers \ mkdir /out && tar -C / -zcf /out/docker-credential-helpers.tgz --exclude .git docker-credential-helpers # deb -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-deb +FROM ${PKG_BASE_IMAGE} AS build-base-deb COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y apt-utils bash curl devscripts equivs git @@ -109,7 +109,7 @@ FROM build-dummy AS builder-deb-windows FROM builder-deb-${TARGETOS} AS builder-deb # rpm -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-rpm +FROM ${PKG_BASE_IMAGE} AS build-base-rpm COPY --from=xx / / ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" @@ -145,10 +145,11 @@ FROM build-dummy AS builder-rpm-windows FROM builder-rpm-${TARGETOS} AS builder-rpm # static +FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS gocross FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-static COPY --from=xx / / ARG DEBIAN_FRONTEND -RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm make pkg-config +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates clang dpkg-dev file git llvm make pkg-config ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" @@ -161,10 +162,11 @@ ARG TARGETPLATFORM ARG CREDENTIAL_HELPERS_VERSION WORKDIR /src RUN --mount=type=bind,from=src,source=/src,target=.,rw \ - --mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod < /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - tilde='~' debVersion="${CREDENTIAL_HELPERS_VERSION#v}" debVersion="${debVersion//-/$tilde}" @@ -63,10 +57,12 @@ ${PKG_NAME} (${PKG_DEB_EPOCH}$([ -n "$PKG_DEB_EPOCH" ] && echo ":")${debVersion} -- $(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control) $(date --rfc-2822) EOF +xx-go --wrap + set -x chmod -x debian/compat debian/control debian/docs -dpkg-buildpackage $PKG_DEB_BUILDFLAGS +dpkg-buildpackage $PKG_DEB_BUILDFLAGS --host-arch $(xx-info debian-arch) --target-arch $(xx-info debian-arch) pkgoutput="${OUTDIR}/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then diff --git a/pkg/credential-helpers/internal/pkg-deb-builddeps.sh b/pkg/credential-helpers/internal/pkg-deb-builddeps.sh index 9ee9afa0..a7e205e9 100755 --- a/pkg/credential-helpers/internal/pkg-deb-builddeps.sh +++ b/pkg/credential-helpers/internal/pkg-deb-builddeps.sh @@ -21,12 +21,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control +mk-build-deps -t "xx-apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control diff --git a/pkg/credential-helpers/internal/pkg-deb-init.sh b/pkg/credential-helpers/internal/pkg-deb-init.sh index c6969954..6804e832 100755 --- a/pkg/credential-helpers/internal/pkg-deb-init.sh +++ b/pkg/credential-helpers/internal/pkg-deb-init.sh @@ -28,12 +28,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in diff --git a/pkg/credential-helpers/internal/pkg-rpm-build.sh b/pkg/credential-helpers/internal/pkg-rpm-build.sh index c1f054c9..874a44b1 100755 --- a/pkg/credential-helpers/internal/pkg-rpm-build.sh +++ b/pkg/credential-helpers/internal/pkg-rpm-build.sh @@ -47,18 +47,19 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse --short HEAD)" fi +xx-go --wrap + set -x +# FIXME: CC is set to a cross package: https://github.com/docker/packaging/pull/25#issuecomment-1256594482 +if ! command "$(go env CC)" &> /dev/null; then + go env -w CC=gcc +fi + tilde='~' rpmVersion="${CREDENTIAL_HELPERS_VERSION#v}" rpmVersion="${rpmVersion//-/$tilde}" @@ -74,7 +75,7 @@ if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" fi -rpmbuild $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec +rpmbuild --target $(xx-info rhel-arch) $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec mkdir -p "${pkgoutput}" cp ./RPMS/*/*.* "${pkgoutput}"/ if [ "$(ls -A ./SRPMS)" ]; then diff --git a/pkg/credential-helpers/internal/pkg-rpm-builddeps.sh b/pkg/credential-helpers/internal/pkg-rpm-builddeps.sh index 84574b71..32dc10b9 100755 --- a/pkg/credential-helpers/internal/pkg-rpm-builddeps.sh +++ b/pkg/credential-helpers/internal/pkg-rpm-builddeps.sh @@ -21,19 +21,18 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -if command -v yum-builddep &> /dev/null; then - yum-builddep -y /root/rpmbuild/SPECS/*.spec -elif command -v dnf &> /dev/null; then - dnf builddep -y /root/rpmbuild/SPECS/*.spec +builddepCmd="" +if command -v dnf &> /dev/null; then + builddepCmd="setarch $(xx-info rhel-arch) dnf builddep" +elif command -v yum-builddep &> /dev/null; then + builddepCmd="yum-builddep --target $(xx-info rhel-arch)" else echo >&2 "unable to detect package manager" exit 1 fi + +set -x + +$builddepCmd -y /root/rpmbuild/SPECS/*.spec diff --git a/pkg/credential-helpers/internal/pkg-rpm-init.sh b/pkg/credential-helpers/internal/pkg-rpm-init.sh index a467177e..1da29f0e 100755 --- a/pkg/credential-helpers/internal/pkg-rpm-init.sh +++ b/pkg/credential-helpers/internal/pkg-rpm-init.sh @@ -28,41 +28,35 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in centos7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release ;; centos8) [ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ] && sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release ;; centos9) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release dnf config-manager --set-enabled crb ;; oraclelinux7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release yum-config-manager --enable ol7_addons --enable ol7_optional_latest ;; oraclelinux8) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol8_addons --enable ol8_codeready_builder ;; oraclelinux9) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol9_addons --enable ol9_codeready_builder ;; fedora*) diff --git a/pkg/credential-helpers/internal/pkg-static-build.sh b/pkg/credential-helpers/internal/pkg-static-build.sh index 180f988c..51a8411e 100755 --- a/pkg/credential-helpers/internal/pkg-static-build.sh +++ b/pkg/credential-helpers/internal/pkg-static-build.sh @@ -34,12 +34,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - pkgoutput="/out/static/$(xx-info os)/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" diff --git a/pkg/credential-helpers/rpm/docker-credential-pass.spec b/pkg/credential-helpers/rpm/docker-credential-pass.spec index b703744f..be32492a 100644 --- a/pkg/credential-helpers/rpm/docker-credential-pass.spec +++ b/pkg/credential-helpers/rpm/docker-credential-pass.spec @@ -15,6 +15,7 @@ Packager: Docker Requires: pass BuildRequires: gcc +BuildRequires: libtool-ltdl-devel BuildRequires: make BuildRequires: pkgconfig diff --git a/pkg/credential-helpers/rpm/docker-credential-secretservice.spec b/pkg/credential-helpers/rpm/docker-credential-secretservice.spec index 8d3930ab..d40acb4f 100644 --- a/pkg/credential-helpers/rpm/docker-credential-secretservice.spec +++ b/pkg/credential-helpers/rpm/docker-credential-secretservice.spec @@ -16,6 +16,7 @@ Requires: libsecret BuildRequires: gcc BuildRequires: libsecret-devel +BuildRequires: libtool-ltdl-devel BuildRequires: make BuildRequires: pkgconfig From 10a66404c54275788e04b272d43e84ed8700ea5c Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 16:06:25 +0200 Subject: [PATCH 06/11] pkg(buildx): refactor since platform compat Signed-off-by: CrazyMax --- pkg/buildx/Makefile | 9 ++++-- pkg/buildx/docker-bake.hcl | 61 ++++++++++---------------------------- 2 files changed, 21 insertions(+), 49 deletions(-) diff --git a/pkg/buildx/Makefile b/pkg/buildx/Makefile index 2d0aed33..d7c4a4f8 100644 --- a/pkg/buildx/Makefile +++ b/pkg/buildx/Makefile @@ -16,16 +16,19 @@ include ../../common/vars.mk DESTDIR ?= $(BASEDIR)/bin BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl -PKG_LIST ?= apk deb rpm static DEFAULT_RULE ?= pkg-multi +PKG_LIST ?= apk deb rpm static +# supported platforms: https://github.com/docker/buildx/blob/e98c2524905e659d34ac01cc328cd21c966be3f2/docker-bake.hcl#L112-L124 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/ppc64le linux/riscv64 linux/s390x windows/amd64 windows/arm64 + .PHONY: all all: $(DEFAULT_RULE) - # noop + @# .PHONY: all-% all-%: $(DEFAULT_RULE)-% - # noop + @# .PHONY: version version: diff --git a/pkg/buildx/docker-bake.hcl b/pkg/buildx/docker-bake.hcl index 4025ad1d..3bd857ae 100644 --- a/pkg/buildx/docker-bake.hcl +++ b/pkg/buildx/docker-bake.hcl @@ -95,7 +95,19 @@ target "_common" { cache-to = [BUILD_CACHE_SCOPE != "" ? "type=gha,scope=${BUILD_CACHE_SCOPE}-${PKG_RELEASE}" : ""] } -target "_platforms" { +# $ PKG_RELEASE=debian11 docker buildx bake pkg +# $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg +group "pkg" { + targets = [substr(BUILDX_VERSION, 0, 1) == "#" ? "_pkg-build" : "_pkg-download"] +} + +# Create release image by using ./bin folder as named context. Make sure all +# pkg targets are called before releasing +target "release" { + inherits = ["meta-helper"] + dockerfile = "../../common/release.Dockerfile" + target = "release" + # same as PKG_PLATFORMS in Makefile platforms = [ "darwin/amd64", "darwin/arm64", @@ -109,27 +121,6 @@ target "_platforms" { "windows/amd64", "windows/arm64" ] -} - -# $ PKG_RELEASE=debian11 docker buildx bake pkg -# $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg -group "pkg" { - targets = [substr(BUILDX_VERSION, 0, 1) == "#" ? "_pkg-build" : "_pkg-download"] -} - -# Same as pkg but for all supported platforms -group "pkg-multi" { - targets = [substr(BUILDX_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"] -} - -# Create release image by using ./bin folder as named context. Therefore -# pkg or pkg-multi target must be run before using this target: -# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi -# $ docker buildx bake release --push --set *.tags=docker/packaging:build-v0.9.1 -target "release" { - inherits = ["meta-helper", "_platforms"] - dockerfile = "../../common/release.Dockerfile" - target = "release" contexts = { bin-folder = "./bin" } @@ -138,13 +129,7 @@ target "release" { target "_pkg-download" { inherits = ["_common"] target = "pkg" - platforms = ["local"] - output = [bindir("local")] -} - -target "_pkg-download-multi" { - inherits = ["_pkg-download", "_platforms"] - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_pkg-build" { @@ -156,19 +141,7 @@ target "_pkg-build" { contexts = { build = "target:_build" } - output = [bindir("local")] -} - -target "_pkg-build-multi" { - inherits = ["_pkg-download-multi"] - args = { - MODE = "build" - BUILDX_VERSION = trimprefix(BUILDX_VERSION, "#") - } - contexts = { - build = "target:_build-multi" - } - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_build" { @@ -180,7 +153,3 @@ target "_build" { } target = "binaries" } - -target "_build-multi" { - inherits = ["build", "_platforms"] -} From 44e64c584234b68cfa9aadb02a00a0b6ad852383 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 16:06:19 +0200 Subject: [PATCH 07/11] pkg(compose): refactor since platform compat Signed-off-by: CrazyMax --- pkg/compose/Makefile | 9 ++++-- pkg/compose/docker-bake.hcl | 60 ++++++++++--------------------------- 2 files changed, 21 insertions(+), 48 deletions(-) diff --git a/pkg/compose/Makefile b/pkg/compose/Makefile index deb0889d..55399d42 100644 --- a/pkg/compose/Makefile +++ b/pkg/compose/Makefile @@ -16,16 +16,19 @@ include ../../common/vars.mk DESTDIR ?= $(BASEDIR)/bin BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl -PKG_LIST ?= apk deb rpm static DEFAULT_RULE ?= pkg-multi +PKG_LIST ?= apk deb rpm static +# supported platforms: https://github.com/docker/compose/blob/e2a3fe94273b05a1428652ba248edeee4171427f/docker-bake.hcl#L95-L107 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/ppc64le linux/riscv64 linux/s390x windows/amd64 windows/arm64 + .PHONY: all all: $(DEFAULT_RULE) - # noop + @# .PHONY: all-% all-%: $(DEFAULT_RULE)-% - # noop + @# .PHONY: version version: diff --git a/pkg/compose/docker-bake.hcl b/pkg/compose/docker-bake.hcl index 43ebf150..016bd05a 100644 --- a/pkg/compose/docker-bake.hcl +++ b/pkg/compose/docker-bake.hcl @@ -95,7 +95,19 @@ target "_common" { cache-to = [BUILD_CACHE_SCOPE != "" ? "type=gha,scope=${BUILD_CACHE_SCOPE}-${PKG_RELEASE}" : ""] } -target "_platforms" { +# $ PKG_RELEASE=debian11 docker buildx bake pkg +# $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg +group "pkg" { + targets = [substr(COMPOSE_VERSION, 0, 1) == "#" ? "_pkg-build" : "_pkg-download"] +} + +# Create release image by using ./bin folder as named context. Make sure all +# pkg targets are called before releasing +target "release" { + inherits = ["meta-helper"] + dockerfile = "../../common/release.Dockerfile" + target = "release" + # same as PKG_PLATFORMS in Makefile platforms = [ "darwin/amd64", "darwin/arm64", @@ -109,27 +121,6 @@ target "_platforms" { "windows/amd64", "windows/arm64" ] -} - -# $ PKG_RELEASE=debian11 docker buildx bake pkg -# $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg -group "pkg" { - targets = [substr(COMPOSE_VERSION, 0, 1) == "#" ? "_pkg-build" : "_pkg-download"] -} - -# Same as pkg but for all supported platforms -group "pkg-multi" { - targets = [substr(COMPOSE_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"] -} - -# Create release image by using ./bin folder as named context. Therefore -# pkg or pkg-multi target must be run before using this target: -# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi -# $ docker buildx bake release --push --set *.tags=docker/packaging:compose-v2.10.2 -target "release" { - inherits = ["meta-helper", "_platforms"] - dockerfile = "../../common/release.Dockerfile" - target = "release" contexts = { bin-folder = "./bin" } @@ -139,12 +130,7 @@ target "_pkg-download" { inherits = ["_common"] target = "pkg" platforms = ["local"] - output = [bindir("local")] -} - -target "_pkg-download-multi" { - inherits = ["_pkg-download", "_platforms"] - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_pkg-build" { @@ -156,19 +142,7 @@ target "_pkg-build" { contexts = { build = "target:_build" } - output = [bindir("local")] -} - -target "_pkg-build-multi" { - inherits = ["_pkg-download-multi"] - args = { - MODE = "build" - COMPOSE_VERSION = trimprefix(COMPOSE_VERSION, "#") - } - contexts = { - build = "target:_build-multi" - } - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_build" { @@ -180,7 +154,3 @@ target "_build" { } target = "binary" } - -target "_build-multi" { - inherits = ["build", "_platforms"] -} From 5192a3cab71a98e3f0fe89fa5a80011f5adeae05 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 16:09:31 +0200 Subject: [PATCH 08/11] pkg(scan): refactor since platform compat Signed-off-by: CrazyMax --- pkg/scan/Makefile | 5 +++- pkg/scan/docker-bake.hcl | 56 ++++++++++------------------------------ 2 files changed, 17 insertions(+), 44 deletions(-) diff --git a/pkg/scan/Makefile b/pkg/scan/Makefile index 3edfe8dc..11080047 100644 --- a/pkg/scan/Makefile +++ b/pkg/scan/Makefile @@ -16,9 +16,12 @@ include ../../common/vars.mk DESTDIR ?= $(BASEDIR)/bin BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl -PKG_LIST ?= apk deb rpm static DEFAULT_RULE ?= pkg-multi +PKG_LIST ?= apk deb rpm static +# supported platforms: https://github.com/docker/scan-cli-plugin/blob/9c797021449e3192a46ba86730d6f0e5409b6614/builder.Makefile#L62-L67 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64 + .PHONY: all all: $(DEFAULT_RULE) # noop diff --git a/pkg/scan/docker-bake.hcl b/pkg/scan/docker-bake.hcl index 834cf823..aff1ecb9 100644 --- a/pkg/scan/docker-bake.hcl +++ b/pkg/scan/docker-bake.hcl @@ -95,35 +95,26 @@ target "_common" { cache-to = [BUILD_CACHE_SCOPE != "" ? "type=gha,scope=${BUILD_CACHE_SCOPE}-${PKG_RELEASE}" : ""] } -target "_platforms" { - platforms = [ - "darwin/amd64", - "darwin/arm64", - "linux/amd64", - "linux/arm64", - "windows/amd64" - ] -} - # $ PKG_RELEASE=debian11 docker buildx bake pkg # $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg group "pkg" { targets = [substr(SCAN_VERSION, 0, 1) == "#" ? "_pkg-build" : "_pkg-download"] } -# Same as pkg but for all supported platforms -group "pkg-multi" { - targets = [substr(SCAN_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"] -} - -# Create release image by using ./bin folder as named context. Therefore -# pkg or pkg-multi target must be run before using this target: -# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi -# $ docker buildx bake release --push --set *.tags=docker/packaging:build-v0.9.1 +# Create release image by using ./bin folder as named context. Make sure all +# pkg targets are called before releasing target "release" { - inherits = ["meta-helper", "_platforms"] + inherits = ["meta-helper"] dockerfile = "../../common/release.Dockerfile" target = "release" + # same as PKG_PLATFORMS in Makefile + platforms = [ + "darwin/amd64", + "darwin/arm64", + "linux/amd64", + "linux/arm64", + "windows/amd64" + ] contexts = { bin-folder = "./bin" } @@ -133,12 +124,7 @@ target "_pkg-download" { inherits = ["_common"] target = "pkg" platforms = ["local"] - output = [bindir("local")] -} - -target "_pkg-download-multi" { - inherits = ["_pkg-download", "_platforms"] - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_pkg-build" { @@ -150,19 +136,7 @@ target "_pkg-build" { contexts = { build = "target:_build" } - output = [bindir("local")] -} - -target "_pkg-build-multi" { - inherits = ["_pkg-download-multi"] - args = { - MODE = "build" - SCAN_VERSION = trimprefix(SCAN_VERSION, "#") - } - contexts = { - build = "target:_build-multi" - } - output = [bindir("multi")] + output = [bindir(PKG_RELEASE)] } target "_build" { @@ -174,7 +148,3 @@ target "_build" { } target = "multi" } - -target "_build-multi" { - inherits = ["build", "_platforms"] -} From ca50630898a13e71b4a41e1dc84f058b294b6bd2 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 17:41:45 +0200 Subject: [PATCH 09/11] pkg(docker-engine): multi arch support and bump to v22.06.0-beta.0 Signed-off-by: CrazyMax --- common/vars.mk | 2 +- pkg/docker-engine/Dockerfile | 48 +++++++++++++------ pkg/docker-engine/Makefile | 9 ++-- pkg/docker-engine/deb/control | 2 +- pkg/docker-engine/deb/rules | 3 +- pkg/docker-engine/docker-bake.hcl | 35 +++++--------- pkg/docker-engine/internal/pkg-deb-build.sh | 10 ++-- .../internal/pkg-deb-builddeps.sh | 8 +--- pkg/docker-engine/internal/pkg-deb-init.sh | 6 --- pkg/docker-engine/internal/pkg-rpm-build.sh | 15 +++--- .../internal/pkg-rpm-builddeps.sh | 24 +++++----- pkg/docker-engine/internal/pkg-rpm-init.sh | 18 +++---- .../internal/pkg-static-build.sh | 6 --- pkg/docker-engine/rpm/docker-ce.spec | 5 +- 14 files changed, 87 insertions(+), 104 deletions(-) diff --git a/common/vars.mk b/common/vars.mk index e74b1f49..27bc801f 100644 --- a/common/vars.mk +++ b/common/vars.mk @@ -53,7 +53,7 @@ export COMPOSE_REPO ?= https://github.com/docker/compose.git export SCAN_REPO ?= https://github.com/docker/scan-cli-plugin.git export CREDENTIAL_HELPERS_REPO ?= https://github.com/docker/docker-credential-helpers.git -export DOCKER_ENGINE_VERSION ?= v20.10.17 +export DOCKER_ENGINE_VERSION ?= v22.06.0-beta.0 export DOCKER_CLI_VERSION ?= v22.06.0-beta.0 export CONTAINERD_VERSION ?= v1.6.8 export BUILDX_VERSION ?= v0.9.1 diff --git a/pkg/docker-engine/Dockerfile b/pkg/docker-engine/Dockerfile index 684e7b97..c8929ce9 100644 --- a/pkg/docker-engine/Dockerfile +++ b/pkg/docker-engine/Dockerfile @@ -18,6 +18,9 @@ ARG XX_VERSION="1.1.2" ARG ALPINE_VERSION="3.16" ARG DEBIAN_FRONTEND="noninteractive" +# specific to docker-engine +ARG GOWINRES_VERSION="v0.2.3" + # go ARG GO_IMAGE="golang" ARG GO_VERSION="1.18.5" @@ -46,7 +49,7 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM dockercore/golang-cross:xx-sdk-extras AS osxsdk # go base image to retrieve /usr/local/go -FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go +FROM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go # dummy stage for unsupported platforms FROM --platform=$BUILDPLATFORM busybox AS builder-dummy @@ -70,7 +73,7 @@ RUN --mount=from=src,source=/src,target=/engine \ mkdir /out && tar -C / -zcf /out/engine.tgz --exclude .git engine # deb -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-deb +FROM ${PKG_BASE_IMAGE} AS build-base-deb COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y bash curl devscripts equivs git @@ -113,7 +116,7 @@ FROM build-dummy AS builder-deb-windows FROM builder-deb-${TARGETOS} AS builder-deb # rpm -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-rpm +FROM ${PKG_BASE_IMAGE} AS build-base-rpm COPY --from=xx / / ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" @@ -155,20 +158,19 @@ FROM build-dummy AS builder-rpm-windows FROM builder-rpm-${TARGETOS} AS builder-rpm # static +FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS gocross FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-static COPY --from=xx / / ARG DEBIAN_FRONTEND -RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm pkg-config +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates clang cmake dpkg-dev file git llvm pkg-config ENV GOPROXY="https://proxy.golang.org|direct" ENV GOPATH="/go" ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" ENV GO111MODULE="off" ARG TARGETPLATFORM RUN xx-apt-get install -y \ - bash \ binutils \ ca-certificates \ - cmake \ curl \ gcc \ g++ \ @@ -178,26 +180,44 @@ RUN xx-apt-get install -y \ libgcc-10-dev \ libltdl-dev \ pkg-config + +FROM build-base-static AS gowinres +ARG GOWINRES_VERSION +RUN --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + GOBIN=/out GO111MODULE=on go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" + FROM build-base-static AS build-static ARG TARGETPLATFORM +ARG TARGETOS ARG DOCKER_ENGINE_VERSION ARG GO_LINKMODE=static ARG DOCKER_BUILDTAGS="apparmor seccomp" WORKDIR /go/src/github.com/docker/docker RUN --mount=type=bind,from=src,source=/src,target=.,rw \ - --mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + --mount=type=bind,from=gowinres,source=/out/go-winres,target=/usr/bin/go-winres \ --mount=type=cache,target=/root/.cache \ + --mount=type=tmpfs,target=cli/winresources/dockerd \ + --mount=type=tmpfs,target=cli/winresources/docker-proxy \ --mount=type=cache,target=/go/pkg/mod <= 1.4.1), +Depends: containerd.io (>= 1.6.4), docker-ce-cli, iptables, libseccomp2 (>= 2.3.0), diff --git a/pkg/docker-engine/deb/rules b/pkg/docker-engine/deb/rules index 39b58390..4f1feb3e 100755 --- a/pkg/docker-engine/deb/rules +++ b/pkg/docker-engine/deb/rules @@ -10,7 +10,6 @@ override_dh_auto_build: ln -snf $(CURDIR)/engine /go/src/github.com/docker/docker cd /go/src/github.com/docker/docker && VERSION=$(DOCKER_ENGINE_VERSION) GITCOMMIT=$(DOCKER_ENGINE_REVISION) PRODUCT=docker ./hack/make.sh dynbinary cd /go/src/github.com/docker/docker && TMP_GOPATH="/go" hack/dockerfile/install/install.sh tini - cd /go/src/github.com/docker/docker && TMP_GOPATH="/go" hack/dockerfile/install/install.sh proxy dynamic cd /go/src/github.com/docker/docker && TMP_GOPATH="/go" hack/dockerfile/install/install.sh rootlesskit dynamic override_dh_auto_test: @@ -24,7 +23,7 @@ override_dh_auto_install: install -D -m 0644 /common/systemd/docker.service debian/docker-ce/lib/systemd/system/docker.service install -D -m 0644 /common/systemd/docker.socket debian/docker-ce/lib/systemd/system/docker.socket install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/dockerd) debian/docker-ce/usr/bin/dockerd - install -D -m 0755 /usr/local/bin/docker-proxy debian/docker-ce/usr/bin/docker-proxy + install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/docker-proxy) debian/docker-ce/usr/bin/docker-proxy install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init # docker-ce-rootless-extras install diff --git a/pkg/docker-engine/docker-bake.hcl b/pkg/docker-engine/docker-bake.hcl index b1b82fd1..1d7aebc6 100644 --- a/pkg/docker-engine/docker-bake.hcl +++ b/pkg/docker-engine/docker-bake.hcl @@ -21,7 +21,7 @@ variable "DOCKER_ENGINE_REPO" { # Sets the docker engine helpers version to build from source. variable "DOCKER_ENGINE_VERSION" { - default = "v20.10.17" + default = "v22.06.0-beta.0" } # Sets Go image, version and variant to use for building @@ -125,17 +125,6 @@ target "_common" { cache-to = [BUILD_CACHE_SCOPE != "" ? "type=gha,scope=${BUILD_CACHE_SCOPE}-${PKG_RELEASE}" : ""] } -target "_platforms" { - platforms = [ - "linux/amd64", - "linux/arm/v7", - "linux/arm64", - "linux/ppc64le", - "linux/s390x", - "windows/amd64" - ] -} - # $ PKG_RELEASE=debian11 docker buildx bake pkg # $ docker buildx bake --set *.platform=linux/amd64 --set *.output=./bin pkg target "pkg" { @@ -144,24 +133,26 @@ target "pkg" { output = [bindir(PKG_RELEASE)] } -# Same as pkg but for all supported platforms -target "pkg-multi" { - inherits = ["pkg", "_platforms"] -} - # Special target: https://github.com/docker/metadata-action#bake-definition target "meta-helper" { tags = ["dockereng/packaging:docker-engine-local"] } -# Create release image by using ./bin folder as named context. Therefore -# pkg-multi target must be run before using this target: -# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi -# $ docker buildx bake release --push --set *.tags=docker/packaging:docker-engine-v20.10.17 +# Create release image by using ./bin folder as named context. Make sure all +# pkg targets are called before releasing target "release" { - inherits = ["meta-helper", "_platforms"] + inherits = ["meta-helper"] dockerfile = "../../common/release.Dockerfile" target = "release" + # same as PKG_PLATFORMS in Makefile + platforms = [ + "linux/amd64", + "linux/arm/v7", + "linux/arm64", + "linux/ppc64le", + "linux/s390x", + "windows/amd64" + ] contexts = { bin-folder = "./bin" } diff --git a/pkg/docker-engine/internal/pkg-deb-build.sh b/pkg/docker-engine/internal/pkg-deb-build.sh index c856d2b0..50b4063f 100755 --- a/pkg/docker-engine/internal/pkg-deb-build.sh +++ b/pkg/docker-engine/internal/pkg-deb-build.sh @@ -48,12 +48,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - tilde='~' debVersion="${DOCKER_ENGINE_VERSION#v}" debVersion="${debVersion//-/$tilde}" @@ -68,10 +62,12 @@ if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse --short HEAD)" fi +xx-go --wrap + set -x chmod -x debian/compat debian/control debian/docs -DOCKER_ENGINE_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS +DOCKER_ENGINE_REVISION=$commit dpkg-buildpackage $PKG_DEB_BUILDFLAGS --host-arch $(xx-info debian-arch) --target-arch $(xx-info debian-arch) pkgoutput="${OUTDIR}/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then diff --git a/pkg/docker-engine/internal/pkg-deb-builddeps.sh b/pkg/docker-engine/internal/pkg-deb-builddeps.sh index 9ee9afa0..a7e205e9 100755 --- a/pkg/docker-engine/internal/pkg-deb-builddeps.sh +++ b/pkg/docker-engine/internal/pkg-deb-builddeps.sh @@ -21,12 +21,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x -mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control +mk-build-deps -t "xx-apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control diff --git a/pkg/docker-engine/internal/pkg-deb-init.sh b/pkg/docker-engine/internal/pkg-deb-init.sh index 3dba2dc4..b441f433 100755 --- a/pkg/docker-engine/internal/pkg-deb-init.sh +++ b/pkg/docker-engine/internal/pkg-deb-init.sh @@ -28,12 +28,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in diff --git a/pkg/docker-engine/internal/pkg-rpm-build.sh b/pkg/docker-engine/internal/pkg-rpm-build.sh index b326e015..de3b6971 100755 --- a/pkg/docker-engine/internal/pkg-rpm-build.sh +++ b/pkg/docker-engine/internal/pkg-rpm-build.sh @@ -47,18 +47,19 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - if [ -d "${SRCDIR}" ]; then commit="$(git --git-dir ${SRCDIR}/.git rev-parse HEAD)" fi +xx-go --wrap + set -x +# FIXME: CC is set to a cross package: https://github.com/docker/packaging/pull/25#issuecomment-1256594482 +if ! command "$(go env CC)" &> /dev/null; then + go env -w CC=gcc +fi + tilde='~' rpmVersion="${DOCKER_ENGINE_VERSION#v}" rpmVersion="${rpmVersion//-/$tilde}" @@ -81,7 +82,7 @@ case "$PKG_RELEASE" in ;; esac -rpmbuild $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec +rpmbuild --target $(xx-info rhel-arch) $PKG_RPM_BUILDFLAGS "${rpmDefine[@]}" /root/rpmbuild/SPECS/*.spec mkdir -p "${pkgoutput}" cp ./RPMS/*/*.* "${pkgoutput}"/ if [ "$(ls -A ./SRPMS)" ]; then diff --git a/pkg/docker-engine/internal/pkg-rpm-builddeps.sh b/pkg/docker-engine/internal/pkg-rpm-builddeps.sh index dc430058..c71c9654 100755 --- a/pkg/docker-engine/internal/pkg-rpm-builddeps.sh +++ b/pkg/docker-engine/internal/pkg-rpm-builddeps.sh @@ -28,25 +28,23 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 +builddepCmd="" +if command -v dnf &> /dev/null; then + builddepCmd="setarch $(xx-info rhel-arch) dnf builddep" +elif command -v yum-builddep &> /dev/null; then + builddepCmd="yum-builddep --target $(xx-info rhel-arch)" +else + echo >&2 "unable to detect package manager" + exit 1 fi set -x case "$PKG_RELEASE" in - centos7) - yum-builddep -y /root/rpmbuild/SPECS/*.spec - ;; - oraclelinux7) - yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec - ;; - centos*|oraclelinux*) - dnf builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec + centos8|centos9|oraclelinux*) + $builddepCmd --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec ;; *) - dnf builddep -y /root/rpmbuild/SPECS/*.spec + $builddepCmd -y /root/rpmbuild/SPECS/*.spec ;; esac diff --git a/pkg/docker-engine/internal/pkg-rpm-init.sh b/pkg/docker-engine/internal/pkg-rpm-init.sh index a467177e..1da29f0e 100755 --- a/pkg/docker-engine/internal/pkg-rpm-init.sh +++ b/pkg/docker-engine/internal/pkg-rpm-init.sh @@ -28,41 +28,35 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - set -x case "$PKG_RELEASE" in centos7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release ;; centos8) [ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo [ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ] && sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release ;; centos9) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release epel-next-release dnf config-manager --set-enabled crb ;; oraclelinux7) [ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo - yum install -y git rpm-build rpmlint + yum install -y git rpm-build rpmlint epel-release yum-config-manager --enable ol7_addons --enable ol7_optional_latest ;; oraclelinux8) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol8_addons --enable ol8_codeready_builder ;; oraclelinux9) - dnf install -y git rpm-build rpmlint dnf-plugins-core + dnf install -y git rpm-build rpmlint dnf-plugins-core epel-release dnf config-manager --enable ol9_addons --enable ol9_codeready_builder ;; fedora*) diff --git a/pkg/docker-engine/internal/pkg-static-build.sh b/pkg/docker-engine/internal/pkg-static-build.sh index f47ba802..a6366b89 100755 --- a/pkg/docker-engine/internal/pkg-static-build.sh +++ b/pkg/docker-engine/internal/pkg-static-build.sh @@ -34,12 +34,6 @@ if ! command -v xx-info &> /dev/null; then exit 1 fi -# TODO: add support for cross comp -if xx-info is-cross; then - echo >&2 "warning: cross compilation with $(xx-info arch) not supported" - exit 0 -fi - pkgoutput="/out/static/$(xx-info os)/$(xx-info arch)" if [ -n "$(xx-info variant)" ]; then pkgoutput="${pkgoutput}/$(xx-info variant)" diff --git a/pkg/docker-engine/rpm/docker-ce.spec b/pkg/docker-engine/rpm/docker-ce.spec index b9653ba1..0ab4dc4a 100644 --- a/pkg/docker-engine/rpm/docker-ce.spec +++ b/pkg/docker-engine/rpm/docker-ce.spec @@ -30,7 +30,7 @@ Requires: iptables # Libcgroup is no longer available in RHEL/CentOS >= 9 distros. Requires: libcgroup %endif -Requires: containerd.io >= 1.4.1 +Requires: containerd.io >= 1.6.4 Requires: tar Requires: xz @@ -83,7 +83,6 @@ rm -f /go/src/github.com/docker/docker ln -snf ${RPM_BUILD_DIR}/src/engine /go/src/github.com/docker/docker pushd /go/src/github.com/docker/docker TMP_GOPATH="/go" hack/dockerfile/install/install.sh tini -TMP_GOPATH="/go" hack/dockerfile/install/install.sh proxy dynamic VERSION=%{_origversion} DOCKER_GITCOMMIT=%{_commit} PRODUCT=docker hack/make.sh dynbinary popd @@ -94,7 +93,7 @@ ver="$(engine/bundles/dynbinary-daemon/dockerd --version)"; \ %install # install binaries install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) ${RPM_BUILD_ROOT}%{_bindir}/dockerd -install -D -p -m 0755 /usr/local/bin/docker-proxy ${RPM_BUILD_ROOT}%{_bindir}/docker-proxy +install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/docker-proxy) ${RPM_BUILD_ROOT}%{_bindir}/docker-proxy install -D -p -m 0755 /usr/local/bin/docker-init ${RPM_BUILD_ROOT}%{_bindir}/docker-init # install systemd scripts From 7eb4f630a2b516ac184b2b8f64cf90e16906eca8 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 17:44:27 +0200 Subject: [PATCH 10/11] disable linux/ppc64le builds for now (too slow with QEMU) Signed-off-by: CrazyMax --- pkg/containerd/Makefile | 3 ++- pkg/credential-helpers/Makefile | 3 ++- pkg/docker-cli/Makefile | 3 ++- pkg/docker-engine/Makefile | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/containerd/Makefile b/pkg/containerd/Makefile index 71638bfe..c11d2720 100644 --- a/pkg/containerd/Makefile +++ b/pkg/containerd/Makefile @@ -22,7 +22,8 @@ PKG_LIST ?= deb rpm static # supported platforms: https://github.com/containerd/containerd/blob/39f7cd73e7cc3e1d24f3557adfce5b68484136f7/.github/workflows/ci.yml#L131-L150 # FIXME: can't build static binaries with containerd Makefile for darwin/amd64 darwin/arm64 windows/amd64 platforms # FIXME: linux/riscv64 needs ubuntu:22.04 image -PKG_PLATFORMS ?= linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/ppc64le linux/s390x +# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) +PKG_PLATFORMS ?= linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x export RUNC_REPO ?= https://github.com/opencontainers/runc.git export RUNC_VERSION ?= diff --git a/pkg/credential-helpers/Makefile b/pkg/credential-helpers/Makefile index a1a3d6cc..9e3e7b39 100644 --- a/pkg/credential-helpers/Makefile +++ b/pkg/credential-helpers/Makefile @@ -20,7 +20,8 @@ DEFAULT_RULE ?= pkg-multi PKG_LIST ?= deb rpm static # supported platforms: https://github.com/docker/docker-credential-helpers/blob/ac5992b5f4756fc0398a7d0c93c609e624368bde/docker-bake.hcl#L56-L66 -PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/ppc64le linux/s390x windows/amd64 +# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x windows/amd64 .PHONY: all all: $(DEFAULT_RULE) diff --git a/pkg/docker-cli/Makefile b/pkg/docker-cli/Makefile index 0ec23aca..4f6fd6dd 100644 --- a/pkg/docker-cli/Makefile +++ b/pkg/docker-cli/Makefile @@ -20,7 +20,8 @@ DEFAULT_RULE ?= pkg-multi PKG_LIST ?= deb rpm static # supported platforms: https://github.com/docker/cli/blob/3e9117b7e241439e314eaf6fe944b4019fbaa941/docker-bake.hcl#L65-L67 -PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm/v7 linux/arm64 linux/ppc64le linux/s390x windows/amd64 +# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm/v7 linux/arm64 linux/s390x windows/amd64 export PKG_DEB_REVISION = 3 export PKG_RPM_RELEASE = 3 diff --git a/pkg/docker-engine/Makefile b/pkg/docker-engine/Makefile index 4ff7610e..1337da61 100644 --- a/pkg/docker-engine/Makefile +++ b/pkg/docker-engine/Makefile @@ -20,7 +20,8 @@ DEFAULT_RULE ?= pkg-multi PKG_LIST ?= deb rpm static # supported platforms: https://github.com/moby/moby/blob/0e873d5cd8b31c08e29ff2f790c19a2e9c4ee30a/.github/workflows/ci.yml#L65-L73 -PKG_PLATFORMS ?= linux/amd64 linux/arm/v7 linux/arm64 linux/ppc64le linux/s390x windows/amd64 +# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) +PKG_PLATFORMS ?= linux/amd64 linux/arm/v7 linux/arm64 linux/s390x windows/amd64 export PKG_DEB_REVISION = 3 export PKG_RPM_RELEASE = 3 From f6655292e6d4fbb6cb8308be695f00f3bddb84e3 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Sep 2022 19:46:58 +0200 Subject: [PATCH 11/11] ci: limit make to a single thread Signed-off-by: CrazyMax --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4704622..cb571f0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: - name: Build run: | - make -j$(nproc) -C pkg/${{ matrix.name }} all-${{ matrix.pkg }} + make -j1 -C pkg/${{ matrix.name }} all-${{ matrix.pkg }} env: BUILD_CACHE_SCOPE: build-${{ matrix.name }}-${{ matrix.pkg }} -