From ea6b77f8647b494e4a47ff49da0712bae2f5228f Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 8 Jan 2025 21:55:46 +0100 Subject: [PATCH] Debian: T7023: download smoketest container images only once When setting up vyos-1x-smoketest package, the required container images will be fetched from the appropriate registry. During development one will re-install the vyos-1x generated packages periodically. In the past this triggered a re-download of the container images for every set-up of the package. Getting image source signatures Copying blob sha256:d3a4026919f923f4e0bb9a23a1e5c2d3c5593d31cbac8d2d6d032285b4852945 Copying config sha256:c1f39daffdeffeb97987901406e2ecef0fb2c2ca236fdfaf570d088426294d91 Writing manifest to image destination Storing signatures Getting image source signatures Copying blob sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e Copying blob sha256:064e2154c8ec1ddeb114ebc9db9a3876ee8883e9a14fe8622c31cb6f17b759f6 Copying blob sha256:7e3fbb46165bc5a98b12c136087a13992e30fe00ab4fab2bbe6c7edd657d8c5b Copying blob sha256:80a416511ac029206f3f824a15b1c94845c410242a1e463c466a1b3081f7e20f Copying blob sha256:339be6688c410f9851f6f09cf0c9d63819f8ca5f2bb09d93ce8c42714842f5ed Copying config sha256:6950ba3bd4492642b6c6c0c5f5bb88a5f2a48f700974a2bdba74333a65d9324e Writing manifest to image destination Storing signatures This change will download the container images only if the image is not present on the system. --- debian/vyos-1x-smoketest.postinst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/debian/vyos-1x-smoketest.postinst b/debian/vyos-1x-smoketest.postinst index 57149af826..08d6d7d4f8 100755 --- a/debian/vyos-1x-smoketest.postinst +++ b/debian/vyos-1x-smoketest.postinst @@ -2,14 +2,12 @@ BUSYBOX_TAG="docker.io/library/busybox:stable" BUSYBOX_PATH="/usr/share/vyos/busybox-stable.tar" -if [[ -f $BUSYBOX_PATH ]]; then - rm -f $BUSYBOX_PATH +if [[ ! -f $BUSYBOX_PATH ]]; then + skopeo copy --additional-tag "$BUSYBOX_TAG" "docker://$BUSYBOX_TAG" "docker-archive:/$BUSYBOX_PATH" fi -skopeo copy --additional-tag "$BUSYBOX_TAG" "docker://$BUSYBOX_TAG" "docker-archive:/$BUSYBOX_PATH" TACPLUS_TAG="docker.io/lfkeitel/tacacs_plus:alpine" TACPLUS_PATH="/usr/share/vyos/tacplus-alpine.tar" -if [[ -f $TACPLUS_PATH ]]; then - rm -f $TACPLUS_PATH +if [[ ! -f $TACPLUS_PATH ]]; then + skopeo copy --additional-tag "$TACPLUS_TAG" "docker://$TACPLUS_TAG" "docker-archive:/$TACPLUS_PATH" fi -skopeo copy --additional-tag "$TACPLUS_TAG" "docker://$TACPLUS_TAG" "docker-archive:/$TACPLUS_PATH"