From 2b68ab06e47e324d5212925bc5055b6c9627e9ee Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Tue, 30 Jan 2024 11:48:42 -0500 Subject: [PATCH] jjb: Use image type to different vm and container distrobuild images Our lxd instance doesn't support applying the same alias to multiple image fingerprints at this time. Change-Id: Id12ade8f6ea1c00be10bc33528448f5b0c016f37 Signed-off-by: Kienan Stewart --- pipelines/images/distrobuild.sh | 4 ++++ pipelines/images/imagebuild.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pipelines/images/distrobuild.sh b/pipelines/images/distrobuild.sh index 7c2e161..a4e6a6c 100644 --- a/pipelines/images/distrobuild.sh +++ b/pipelines/images/distrobuild.sh @@ -181,6 +181,10 @@ if [[ "${ARCH}" == "i386" ]] ; then rm -rf "${TMP_DIR}" fi +# When using `lxc image import` two images cannot have the same alias - +# only the last image imported will keep the alias. Therefore, the +# image type is appended as part of the alias. +IMAGE_NAME="${IMAGE_NAME}/${IMAGE_TYPE}" lxc image import "${BUILD_DIR}/incus.tar.xz" "${ROOTFS}" --alias="${IMAGE_NAME}" ci: if [[ "${TEST}" == "true" ]] ; then diff --git a/pipelines/images/imagebuild.sh b/pipelines/images/imagebuild.sh index 340f71c..ecc192d 100644 --- a/pipelines/images/imagebuild.sh +++ b/pipelines/images/imagebuild.sh @@ -91,7 +91,7 @@ set +e TRIES_MAX=3 TRIES=0 while [[ "${TRIES}" -lt "${TRIES_MAX}" ]] ; do - if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" "${SOURCE_IMAGE_NAME}") ; then + if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" "${SOURCE_IMAGE_NAME}/${IMAGE_TYPE}") ; then # Try from images if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" images:"${SOURCE_IMAGE_NAME}") ; then TRIES=$((TRIES + 1)) -- 2.34.1