From 343f25cea8757e512779c4e195007863b6a27c58 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Sat, 27 Apr 2024 00:18:34 +0100 Subject: [PATCH] Add script that grabs image names for GCE --- get_image_names.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 get_image_names.sh diff --git a/get_image_names.sh b/get_image_names.sh new file mode 100755 index 0000000..6da1de3 --- /dev/null +++ b/get_image_names.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Grab bionic image name + +bionic_json=$(gcloud compute images list --project ubuntu-os-cloud --filter="family:ubuntu-1804-lts" --show-deprecated --format=json) +bionic_image=$(echo ${bionic_json} | jq -rc '.[] | select(.architecture == "X86_64") | .name' | sort | tail -n 1) +echo ${bionic_image} + + +# Grab IDs for the other images + +families="ubuntu-2004-lts ubuntu-2204-lts ubuntu-2404-lts-amd64 ubuntu-minimal-2404-lts-amd64" + +for family in ${families} +do + distro_json=$(gcloud compute images list --project ubuntu-os-cloud --filter="family:${family}" --format=json) + + distro_image=$(echo ${distro_json} | jq -rc '.[] | select(.architecture == "X86_64") | .name') + + echo $distro_image + +done + +# Fpr testing for the next daily release depdning on LTS or non-LTS + +#gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2410-amd64" +#gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2404-lts-amd64"