From 39194a01acb4bfaf51f6d59a0a77b1988519620f Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Mon, 3 Jun 2024 16:56:07 +0200 Subject: [PATCH 1/2] conf: distro: set default docker API version This is used to match the API version used in the build pipeline with the balena version used in the image. Change-type: patch Signed-off-by: Alex Gonzalez --- meta-balena-common/conf/distro/include/balena-os.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta-balena-common/conf/distro/include/balena-os.inc b/meta-balena-common/conf/distro/include/balena-os.inc index 6a07f3a5c1..b958375ced 100644 --- a/meta-balena-common/conf/distro/include/balena-os.inc +++ b/meta-balena-common/conf/distro/include/balena-os.inc @@ -147,3 +147,6 @@ BALENA_SIGN_LABEL ?= "${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'balena-ef BALENA_NONENC_BOOT_LABEL ?= "${@oe.utils.conditional('SIGN_API','','${BALENA_BOOT_LABEL}','${BALENA_SIGN_LABEL}',d)}" BALENA_NONENC_BOOT_MOUNT ?= "/mnt/${@'${BALENA_NONENC_BOOT_LABEL}'.replace('balena-','')}" +# This is the docker API version for v20.10 +# balena version --format '{{.Server.APIVersion}}' +BALENA_API_VERSION ?= "1.41" From b129f29043de773bf9f6b2259e30cd62487c3d41 Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Mon, 3 Jun 2024 16:57:21 +0200 Subject: [PATCH 2/2] Update docker API version to match the v20.10 engine version Update the API version to the version set in the distro configuration, which must match the API version of the balena package. Change-type: patch Signed-off-by: Alex Gonzalez --- meta-balena-common/classes/image_types_balena.bbclass | 4 ++-- .../mkfs-hostapp-native/mkfs-hostapp-native.bb | 6 +++--- .../recipes-kernel/linux/kernel-headers-test.bb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/meta-balena-common/classes/image_types_balena.bbclass b/meta-balena-common/classes/image_types_balena.bbclass index 52b2a9654e..776dc8d368 100644 --- a/meta-balena-common/classes/image_types_balena.bbclass +++ b/meta-balena-common/classes/image_types_balena.bbclass @@ -384,8 +384,8 @@ do_rootfs[vardeps] += "BALENA_BOOT_PARTITION_FILES" # XXX(petrosagg): This should be eventually implemented using a docker-native daemon IMAGE_CMD:docker () { - DOCKER_IMAGE=$(${IMAGE_CMD_TAR} -cv -C ${IMAGE_ROOTFS} . | DOCKER_API_VERSION=1.22 docker import -) - DOCKER_API_VERSION=1.22 docker save ${DOCKER_IMAGE} > ${BALENA_DOCKER_IMG} + DOCKER_IMAGE=$(${IMAGE_CMD_TAR} -cv -C ${IMAGE_ROOTFS} . | DOCKER_API_VERSION=${BALENA_API_VERSION} docker import -) + DOCKER_API_VERSION=${BALENA_API_VERSION} docker save ${DOCKER_IMAGE} > ${BALENA_DOCKER_IMG} } IMAGE_TYPEDEP:hostapp-ext4 = "docker" diff --git a/meta-balena-common/recipes-containers/mkfs-hostapp-native/mkfs-hostapp-native.bb b/meta-balena-common/recipes-containers/mkfs-hostapp-native/mkfs-hostapp-native.bb index aa31a59cb1..7d5d7fb65e 100644 --- a/meta-balena-common/recipes-containers/mkfs-hostapp-native/mkfs-hostapp-native.bb +++ b/meta-balena-common/recipes-containers/mkfs-hostapp-native/mkfs-hostapp-native.bb @@ -37,9 +37,9 @@ do_compile () { done IMAGETAG="${PN}:$(date +%s)" - DOCKER_API_VERSION=1.22 docker build --tag ${IMAGETAG} ${B}/work - DOCKER_API_VERSION=1.22 docker save "$IMAGETAG" > ${B}/work/mkfs-hostapp-image.tar - DOCKER_API_VERSION=1.22 docker rmi "$IMAGETAG" + DOCKER_API_VERSION=${BALENA_API_VERSION} docker build --tag ${IMAGETAG} ${B}/work + DOCKER_API_VERSION=${BALENA_API_VERSION} docker save "$IMAGETAG" > ${B}/work/mkfs-hostapp-image.tar + DOCKER_API_VERSION=${BALENA_API_VERSION} docker rmi "$IMAGETAG" sed -i "s/@IMAGE@/${IMAGETAG}/" ${B}/work/mkfs.hostapp } diff --git a/meta-balena-common/recipes-kernel/linux/kernel-headers-test.bb b/meta-balena-common/recipes-kernel/linux/kernel-headers-test.bb index 8a68f4d8cf..eda6a2c13b 100644 --- a/meta-balena-common/recipes-kernel/linux/kernel-headers-test.bb +++ b/meta-balena-common/recipes-kernel/linux/kernel-headers-test.bb @@ -37,8 +37,8 @@ do_compile() { cp -r "${WORKDIR}"/example_module ${B}/work/ IMAGETAG="${PN}:$(date +%s)" - DOCKER_API_VERSION=1.22 docker build --tag ${IMAGETAG} --build-arg kernel_arch=${ARCH} --build-arg cross_compile_prefix=${DEBIAN_TUPLE} ${B}/work - DOCKER_API_VERSION=1.22 docker rmi "$IMAGETAG" + DOCKER_API_VERSION=${BALENA_API_VERSION} docker build --tag ${IMAGETAG} --build-arg kernel_arch=${ARCH} --build-arg cross_compile_prefix=${DEBIAN_TUPLE} ${B}/work + DOCKER_API_VERSION=${BALENA_API_VERSION} docker rmi "$IMAGETAG" } # Explicitly depend on the do_deploy step as we use the deployed artefacts. DEPENDS doesn't cover that