ci: fix Docker buildx caching

In commit 00596caaf91d ("ci: docker: bump containers to Docker version
26") we've updated from Docker version 19 to latest 26 which made the
LCM container CI test job failing as both lcm-test-x86-64-v1 and
lcm-test-x86-64-v2 containers containers are same, so the test checking
for different content of /etc/container-version fails:

 docker run registry.gitlab.com/prpl-foundation/prplos/lcm-test-x86-64-v1:prplos cat /etc/container-version
 1

 docker run registry.gitlab.com/prpl-foundation/prplos/lcm-test-x86-64-v2:prplos cat /etc/container-version
 1

It seems, that this new Docker version changed somehow the behavior of
layer caching and thus Docker is no longer able to find out if the
content defined in `ADD ./ /` changed, thus reusing the cached layers.

So lets fix it by pruning the Docker build cache before each v1/v2
container build, so we're sure, that no cache is being used.

I would like to point out, that I've tried to use `docker build
--no-cache` first, but it didn't worked out.

Fixes: 00596caaf91d ("ci: docker: bump containers to Docker version 26")
Signed-off-by: Petr Štetiar <petr.stetiar@prplfoundation.org>
This commit is contained in:
Petr Štetiar 2024-06-05 10:40:56 +00:00
parent 5811f6f7b2
commit 8caaed0fe7
No known key found for this signature in database
GPG Key ID: 58EE120F30CC02D3

View File

@ -59,6 +59,8 @@ build_push_container()
mkdir -p "$rootfs_dir"
tar -C "$rootfs_dir" -xf "$rootfs"
docker buildx prune --force
docker build \
--tag "$container_name" \
--file .gitlab/docker/ib/lcm/Dockerfile \