Fix get image names, now correctly gets all

This commit is contained in:
2025-09-08 17:35:25 +01:00
parent 3ad8ddab88
commit fa269a2732
+13 -18
View File
@@ -1,46 +1,41 @@
#!/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
check_distro()
{
families=$1
project=$2
arch_add=""
[[ "${project}" == "ubuntu"* ]] && arch_add='| select(.architecture == "X86_64")'
[[ "${project}" == "ubuntu"* ]] && arch_add="| select(.architecture == \"X86_64\")"
for family in ${families}
do
distro_json=$(gcloud compute images list --project ${project} --filter="family:${family}" --format=json)
distro_image=$(echo ${distro_json} | jq -rc '.[] '$arch_add' | .name')
echo $distro_image
gcloud compute images list --project ${project} --filter="family:${family}" --format=json | \
jq -rc ".[] ${arch_add} | .name"
done
}
families="fedora-cloud-38 fedora-cloud-39"
# Check Fedora stable images
families="fedora-cloud-41 fedora-cloud-42"
project="fedora-cloud"
check_distro "$families" "$project"
families="ubuntu-2004-lts ubuntu-2204-lts ubuntu-2404-lts-amd64"
# Check Ubuntu stable images
families="ubuntu-2204-lts ubuntu-2404-lts-amd64"
project="ubuntu-os-cloud"
check_distro "$families" "$project"
latest_sup_rev="2410"
latest_sup_rev="2504"
gcloud compute images list --project ubuntu-os-cloud --filter="family:ubuntu-${latest_sup_rev}-amd64"
gcloud compute images list --project ubuntu-os-cloud --filter="family:ubuntu-minimal-${latest_sup_rev}-amd64"
# For testing for the next daily release depdning on LTS or non-LTS
# For testing for the next daily release depending on LTS or non-LTS
dev_rel=2510
lts_rel=2404
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2504-amd64"
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2404-lts-amd64"
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-${dev_rel}-amd64"
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-${lts_rel}-lts-amd64"