From f21265b64b9f19bdac68c4a65dab6a769806b3e9 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Tue, 6 Aug 2024 11:49:45 +0100 Subject: [PATCH 1/3] Compress images --- builder/build-image.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/builder/build-image.sh b/builder/build-image.sh index 7244424..b730a22 100755 --- a/builder/build-image.sh +++ b/builder/build-image.sh @@ -29,15 +29,19 @@ packer plugins install github.com/hashicorp/ansible # do the build if tools/build.sh "$IMAGE" >/var/log/image-build.log 2>&1; then - builder/refresh.sh vo.access.egi.eu "$(cat /var/tmp/egi/.refresh_token)" images - OS_TOKEN="$(yq -r '.clouds.images.auth.token' /etc/openstack/clouds.yaml)" + # compress the resulting image VM_NAME="$(jq -r ".builders[].vm_name" < "$IMAGE")" cd "$(dirname "$IMAGE")/output-qemu" - SHA="$(sha512sum -z "$VM_NAME" | cut -f1 -d" ")" + QCOW_FILE="$VM_NAME.qcow2" + qemu-img convert -O qcow2 -c "$VM_NAME" "$QCOW_FILE" + builder/refresh.sh vo.access.egi.eu "$(cat /var/tmp/egi/.refresh_token)" images + OS_TOKEN="$(yq -r '.clouds.images.auth.token' /etc/openstack/clouds.yaml)" + SHA="$(sha512sum -z "$QCOW_FILE" | cut -f1 -d" ")" + ls -lh $QCOW_FILE >>/var/log/image-build.log openstack --os-cloud images --os-token "$OS_TOKEN" \ object create egi_endorsed_vas \ - "$VM_NAME" >>/var/log/image-build.log - echo "SUCCESSFUL BUILD - $VM_NAME - $SHA" >>/var/log/image-build.log + "$QCOW_FILE" >>/var/log/image-build.log + echo "SUCCESSFUL BUILD - $QCOW_FILE - $SHA" >>/var/log/image-build.log fi echo "BUILD ENDED" >>/var/log/image-build.log From 3626c082f2a3b178ce56f03094eabc832bbe7815 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Tue, 6 Aug 2024 11:49:52 +0100 Subject: [PATCH 2/3] Rebuild ubuntu22 --- ubuntu/ubuntu-22.04.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu/ubuntu-22.04.json b/ubuntu/ubuntu-22.04.json index a428dfb..898b57f 100644 --- a/ubuntu/ubuntu-22.04.json +++ b/ubuntu/ubuntu-22.04.json @@ -34,7 +34,7 @@ "qemuargs": [ [ "-cpu", "host" ] ], - "vm_name": "Ubuntu.22.04-2024.07.31" + "vm_name": "Ubuntu.22.04-2024.08.06" } ], "provisioners": [ From b8d20d78f87dc8edd1ad2796e4cb23d5084905b1 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Tue, 6 Aug 2024 12:16:42 +0100 Subject: [PATCH 3/3] Linting fixes --- builder/build-image.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/builder/build-image.sh b/builder/build-image.sh index b730a22..4a36770 100755 --- a/builder/build-image.sh +++ b/builder/build-image.sh @@ -37,11 +37,13 @@ if tools/build.sh "$IMAGE" >/var/log/image-build.log 2>&1; then builder/refresh.sh vo.access.egi.eu "$(cat /var/tmp/egi/.refresh_token)" images OS_TOKEN="$(yq -r '.clouds.images.auth.token' /etc/openstack/clouds.yaml)" SHA="$(sha512sum -z "$QCOW_FILE" | cut -f1 -d" ")" - ls -lh $QCOW_FILE >>/var/log/image-build.log - openstack --os-cloud images --os-token "$OS_TOKEN" \ - object create egi_endorsed_vas \ - "$QCOW_FILE" >>/var/log/image-build.log - echo "SUCCESSFUL BUILD - $QCOW_FILE - $SHA" >>/var/log/image-build.log + { + ls -lh "$QCOW_FILE" + openstack --os-cloud images --os-token "$OS_TOKEN" \ + object create egi_endorsed_vas \ + "$QCOW_FILE" + echo "SUCCESSFUL BUILD - $QCOW_FILE - $SHA" + } >>/var/log/image-build.log fi echo "BUILD ENDED" >>/var/log/image-build.log