From 483a66dc3e31108d1384294cc8cd9ded84583d51 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 10:31:30 +0100 Subject: [PATCH 1/7] deb: remove unused GITCOMMIT make var Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e49e4d76fab0b1dfd8d43d0a99a6cdaf7ca145d3) Signed-off-by: Sebastiaan van Stijn --- deb/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/deb/Makefile b/deb/Makefile index f85e6c374b..45d1665fcc 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -1,7 +1,6 @@ include ../common.mk PLUGINS_DIR=$(realpath $(CURDIR)/../plugins) -GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD) CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD) ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) GO_BASE_IMAGE=golang From 48c780b442025900cc66beaa5eac66ccb4126362 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 10:35:18 +0100 Subject: [PATCH 2/7] deb: Makefile: sort vars similar to rpm variant For easier comparing :) Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 0f8737cc3ce9031daafc04316f3abafa5a30cb72) Signed-off-by: Sebastiaan van Stijn --- deb/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deb/Makefile b/deb/Makefile index 45d1665fcc..d4649158f2 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -1,12 +1,12 @@ include ../common.mk PLUGINS_DIR=$(realpath $(CURDIR)/../plugins) -CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD) -ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) GO_BASE_IMAGE=golang GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster -GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)") EPOCH?=5 +GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)") +CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD) +ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) && git rev-parse --short HEAD) ifdef BUILD_IMAGE From 008f733a3d92f09dcb4a9acbe6008c479177fc15 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 12:23:30 +0100 Subject: [PATCH 3/7] deb: pass VERSION_ID through Dockerfile We'll be using VERSION_ID in other places, so adding it in the Dockerfile makes sure it's always present, without having to depend on /etc/os-release. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e1551c7ca155ce6aa5a7856e8df77b9c07c57384) Signed-off-by: Sebastiaan van Stijn --- deb/debian-bullseye/Dockerfile | 3 +++ deb/debian-buster/Dockerfile | 3 +++ deb/raspbian-bullseye/Dockerfile | 3 +++ deb/raspbian-buster/Dockerfile | 3 +++ deb/ubuntu-bionic/Dockerfile | 3 +++ deb/ubuntu-focal/Dockerfile | 3 +++ deb/ubuntu-jammy/Dockerfile | 3 +++ deb/ubuntu-kinetic/Dockerfile | 3 +++ 8 files changed, 24 insertions(+) diff --git a/deb/debian-bullseye/Dockerfile b/deb/debian-bullseye/Dockerfile index 0377ad3c5c..5e85b5e6fb 100644 --- a/deb/debian-bullseye/Dockerfile +++ b/deb/debian-bullseye/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=debian ARG SUITE=bullseye +ARG VERSION_ID=11 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -25,8 +26,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/debian-buster/Dockerfile b/deb/debian-buster/Dockerfile index a9846b7ccf..c4ec06b944 100644 --- a/deb/debian-buster/Dockerfile +++ b/deb/debian-buster/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=debian ARG SUITE=buster +ARG VERSION_ID=10 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -25,8 +26,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/raspbian-bullseye/Dockerfile b/deb/raspbian-bullseye/Dockerfile index 823947a28e..cbab3b6c79 100644 --- a/deb/raspbian-bullseye/Dockerfile +++ b/deb/raspbian-bullseye/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=raspbian ARG SUITE=bullseye +ARG VERSION_ID=11 ARG BUILD_IMAGE=balenalib/rpi-raspbian:${SUITE} FROM ${GO_IMAGE} AS golang @@ -25,8 +26,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/raspbian-buster/Dockerfile b/deb/raspbian-buster/Dockerfile index 97a56a8d5e..44b2031b79 100644 --- a/deb/raspbian-buster/Dockerfile +++ b/deb/raspbian-buster/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=raspbian ARG SUITE=buster +ARG VERSION_ID=10 ARG BUILD_IMAGE=balenalib/rpi-raspbian:${SUITE} FROM ${GO_IMAGE} AS golang @@ -25,8 +26,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/ubuntu-bionic/Dockerfile b/deb/ubuntu-bionic/Dockerfile index 12654cd691..a8c6b44e57 100644 --- a/deb/ubuntu-bionic/Dockerfile +++ b/deb/ubuntu-bionic/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=ubuntu ARG SUITE=bionic +ARG VERSION_ID=18.04 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -25,8 +26,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/ubuntu-focal/Dockerfile b/deb/ubuntu-focal/Dockerfile index 985e5397c5..d2512ef2bd 100644 --- a/deb/ubuntu-focal/Dockerfile +++ b/deb/ubuntu-focal/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=ubuntu ARG SUITE=focal +ARG VERSION_ID=20.04 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -31,8 +32,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/ubuntu-jammy/Dockerfile b/deb/ubuntu-jammy/Dockerfile index 008d292dc4..3f36dbdebe 100644 --- a/deb/ubuntu-jammy/Dockerfile +++ b/deb/ubuntu-jammy/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=ubuntu ARG SUITE=jammy +ARG VERSION_ID=22.04 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -31,8 +32,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go diff --git a/deb/ubuntu-kinetic/Dockerfile b/deb/ubuntu-kinetic/Dockerfile index eab31851db..28f3db043b 100644 --- a/deb/ubuntu-kinetic/Dockerfile +++ b/deb/ubuntu-kinetic/Dockerfile @@ -1,6 +1,7 @@ ARG GO_IMAGE ARG DISTRO=ubuntu ARG SUITE=kinetic +ARG VERSION_ID=22.10 ARG BUILD_IMAGE=${DISTRO}:${SUITE} FROM ${GO_IMAGE} AS golang @@ -31,8 +32,10 @@ RUN apt-get update \ COPY sources/ /sources ARG DISTRO ARG SUITE +ARG VERSION_ID ENV DISTRO=${DISTRO} ENV SUITE=${SUITE} +ENV VERSION_ID=${VERSION_ID} COPY --from=golang /usr/local/go /usr/local/go From 12b9474377a01022606a18de0fe4af967929b9fa Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 16:50:18 +0100 Subject: [PATCH 4/7] deb: fix plugin versions to have correct format for deb packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already had code for this in the RPM packages, but were missing this in the deb variants. Because of this, pre-release packages used a hyphen (-) as separator for pre-releases, which get sorted as a "higher" version than a non-pre-release: dpkg --compare-versions "0.10.0" ">>" "0.10.0-rc2" && echo "OK" || echo "KO" KO With this patch, the packages have a correctly formatted version, using a tilde (~) as separator for the pre-release suffix: make DOCKER_CLI_REF=f163d2441e214176db89c63ffc557012113e28d8 DOCKER_ENGINE_REF=9fd3a437a6027637301b0952f7578644d7dff321 VERSION=23.0.0-rc.2 ubuntu-jammy tree deb/debbuild/ deb/debbuild/ └── ubuntu-jammy ├── docker-buildx-plugin_0.10.0~rc2~ubuntu-jammy_arm64.deb ├── docker-ce-cli_23.0.0~rc.2-0~ubuntu.22.04.0~jammy_arm64.deb ├── docker-ce-rootless-extras_23.0.0~rc.2-0~ubuntu.22.04.0~jammy_arm64.deb ├── docker-ce_23.0.0~rc.2-0~ubuntu.22.04.0~jammy.dsc ├── docker-ce_23.0.0~rc.2-0~ubuntu.22.04.0~jammy.tar.gz ├── docker-ce_23.0.0~rc.2-0~ubuntu.22.04.0~jammy_arm64.buildinfo ├── docker-ce_23.0.0~rc.2-0~ubuntu.22.04.0~jammy_arm64.changes ├── docker-ce_23.0.0~rc.2-0~ubuntu.22.04.0~jammy_arm64.deb └── docker-compose-plugin_2.15.1~ubuntu-jammy_arm64.deb Using a tilde makes sure that pre-releases are sorted correctly: dpkg --compare-versions "0.10.0" ">>" "0.10.0~rc2" && echo "OK" || echo "KO" OK The version reported through `docker buildx version` still uses the version as tagged in the repository (using a hyphen (-)); make IMAGE=ubuntu:jammy verify + verify_binaries ... + docker buildx version github.com/docker/buildx v0.10.0-rc2 64e4c19 ... Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e8d994c3323ce8c088ced4c3de38f1a33548ea3c) Signed-off-by: Sebastiaan van Stijn --- deb/Makefile | 4 ++++ deb/common/rules | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deb/Makefile b/deb/Makefile index d4649158f2..3e04ffeadb 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -5,6 +5,8 @@ GO_BASE_IMAGE=golang GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster EPOCH?=5 GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)") +GEN_COMPOSE_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_REF)") +GEN_SCAN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) "$(DOCKER_SCAN_REF)") CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD) ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) && git rev-parse --short HEAD) @@ -33,7 +35,9 @@ RUN?=docker run --rm \ -e CLI_GITCOMMIT=$(CLI_GITCOMMIT) \ -e ENGINE_GITCOMMIT=$(ENGINE_GITCOMMIT) \ -e COMPOSE_VERSION=$(DOCKER_COMPOSE_REF) \ + -e COMPOSE_DEB_VERSION=$(word 1, $(GEN_COMPOSE_DEB_VER)) \ -e SCAN_VERSION=$(DOCKER_SCAN_REF) \ + -e SCAN_DEB_VERSION=$(word 1, $(GEN_SCAN_DEB_VER)) \ -e SCAN_GITCOMMIT=$(SCAN_GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ $(RUN_FLAGS) \ diff --git a/deb/common/rules b/deb/common/rules index 3e35254af8..c7d4586b5c 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -109,13 +109,13 @@ override_dh_install: override_dh_gencontrol: # Use separate version for the compose-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to compose, as it doesn't match the package name) - dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_VERSION#v}~$${DISTRO}-$${SUITE} + dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_DEB_VERSION#v}~$${DISTRO}-$${SUITE} # Use separate version for the scan-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to scan-cli-plugin, as it doesn't match the package name) # TODO change once we support scan-plugin on other architectures (see dpkg-architecture -L) if [ "$(TARGET_ARCH)" = "amd64" ]; then \ - dh_gencontrol -pdocker-scan-plugin -- -v$${SCAN_VERSION#v}~$${DISTRO}-$${SUITE}; \ + dh_gencontrol -pdocker-scan-plugin -- -v$${SCAN_DEB_VERSION#v}~$${DISTRO}-$${SUITE}; \ fi dh_gencontrol --remaining-packages From 37edc584fa0c38597e1e1c7077dd4f52a3df8926 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 20:24:11 +0100 Subject: [PATCH 5/7] deb: introduce PKG_REVISION variable This variable can be used as packaging-revision in package versions Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 3e7b469e3c5aaf5bc4bcaeee825e6a353b157fa3) Signed-off-by: Sebastiaan van Stijn --- deb/common/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deb/common/rules b/deb/common/rules index c7d4586b5c..62a422bf8f 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -2,6 +2,9 @@ VERSION ?= $(shell cat engine/VERSION) TARGET_ARCH = $(shell dpkg-architecture -qDEB_TARGET_ARCH) +# TODO(thaJeztah): allow passing this version when building. +PKG_REVISION ?= 1 +export PKG_REVISION # force packages to be built with xz compression, as Ubuntu 21.10 and up use # zstd compression, which is non-standard, and breaks 'dpkg-sig --verify' From fd43ffc831243b0d60bdd93038304accafcc6b51 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 20:23:23 +0100 Subject: [PATCH 6/7] deb: compose: include packaging revision and distro version in version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligning the plugin's version with the format used for docker-ce and docker-ce-cli, as updated in 39772a761dfdf810cc23a1ec6084ea3100e6abf0 Before this patch: deb/debbuild/ └── ubuntu-jammy ├── docker-buildx-plugin_0.10.0-1~ubuntu.22.04-jammy_arm64.deb ├── docker-ce-cli_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb ├── docker-ce-rootless-extras_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb ├── docker-ce_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb └── docker-compose-plugin_2.15.1~ubuntu-jammy_arm64.deb With this patch: deb/debbuild/ └── ubuntu-jammy ├── docker-buildx-plugin_0.10.0-1~ubuntu.22.04-jammy_arm64.deb ├── docker-ce-cli_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb ├── docker-ce-rootless-extras_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb ├── docker-ce_23.0.0~rc.2-1~ubuntu.22.04~jammy_arm64.deb └── docker-compose-plugin_2.15.1-1~ubuntu.22.04-jammy_arm64.deb Signed-off-by: Sebastiaan van Stijn (cherry picked from commit cdca6d2276639516615cc726d7361d31aa0d0976) Signed-off-by: Sebastiaan van Stijn --- deb/common/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb/common/rules b/deb/common/rules index 62a422bf8f..4b383cea31 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -112,7 +112,7 @@ override_dh_install: override_dh_gencontrol: # Use separate version for the compose-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to compose, as it doesn't match the package name) - dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_DEB_VERSION#v}~$${DISTRO}-$${SUITE} + dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_DEB_VERSION#v}-$${PKG_REVISION}~$${DISTRO}.$${VERSION_ID}-$${SUITE} # Use separate version for the scan-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to scan-cli-plugin, as it doesn't match the package name) From e69b795221d6963177e283becdb9a04694b0ec61 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 12 Jan 2023 00:07:35 +0100 Subject: [PATCH 7/7] deb: compose: fix hyphen instead of tilde Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 9e92e212433224880f0dbdd79867e12f076d52ed) Signed-off-by: Sebastiaan van Stijn --- deb/common/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb/common/rules b/deb/common/rules index 4b383cea31..6e9231da79 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -112,7 +112,7 @@ override_dh_install: override_dh_gencontrol: # Use separate version for the compose-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to compose, as it doesn't match the package name) - dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_DEB_VERSION#v}-$${PKG_REVISION}~$${DISTRO}.$${VERSION_ID}-$${SUITE} + dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_DEB_VERSION#v}-$${PKG_REVISION}~$${DISTRO}.$${VERSION_ID}~$${SUITE} # Use separate version for the scan-plugin package, then generate the other control files as usual # TODO override "Source" field in control as well (to point to scan-cli-plugin, as it doesn't match the package name)