Skip to content

Commit 7b3cd68

Browse files
try with two regions
Signed-off-by: Sayan Chowdhury <[email protected]>
1 parent 8202c6d commit 7b3cd68

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

az_sig_publish

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ TARGET_REGIONS="${TARGET_REGIONS:-}"
3232
function publish-flatcar-sig-image-version-from-vhd() {
3333
login
3434

35-
if sig-image-version-exists; then
36-
return
37-
fi
38-
3935
get-target-regions
4036
ensure-vhd-uri-exists
4137
ensure-resource-group
@@ -45,13 +41,18 @@ function publish-flatcar-sig-image-version-from-vhd() {
4541
STORAGE_ACCOUNT_ID="/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${VHD_STORAGE_RESOURCE_GROUP_NAME}/providers/Microsoft.Storage/storageAccounts/${VHD_STORAGE_ACCOUNT_NAME}"
4642
VHD_URI="https://${VHD_STORAGE_ACCOUNT_NAME}.blob.core.windows.net/${VHD_STORAGE_CONTAINER_NAME}/flatcar-linux-${FLATCAR_GALLERY_VERSION}-${FLATCAR_CHANNEL}-${FLATCAR_ARCH}.vhd"
4743

48-
az sig image-version create \
49-
--resource-group "${SIG_RESOURCE_GROUP}" \
50-
--gallery-name "${FLATCAR_GALLERY_NAME}" \
51-
--gallery-image-definition "${FLATCAR_GALLERY_IMAGE_NAME}" \
52-
--gallery-image-version "${FLATCAR_GALLERY_VERSION}" \
53-
--os-vhd-storage-account "${STORAGE_ACCOUNT_ID}" \
54-
--os-vhd-uri "${VHD_URI}" \
44+
if ! sig-image-version-exists; then
45+
echo "Creating SIG image version ${FLATCAR_GALLERY_VERSION}"
46+
az sig image-version create \
47+
--resource-group "${SIG_RESOURCE_GROUP}" \
48+
--gallery-name "${FLATCAR_GALLERY_NAME}" \
49+
--gallery-image-definition "${FLATCAR_GALLERY_IMAGE_NAME}" \
50+
--gallery-image-version "${FLATCAR_GALLERY_VERSION}" \
51+
--os-vhd-storage-account "${STORAGE_ACCOUNT_ID}" \
52+
--os-vhd-uri "${VHD_URI}"
53+
else
54+
echo "SIG image version ${FLATCAR_GALLERY_VERSION} already exists, skipping creation"
55+
fi
5556

5657
sig-image-version-update-regions
5758
}
@@ -63,6 +64,7 @@ function get-target-regions() {
6364

6465
echo "Fetching target regions"
6566
TARGET_REGIONS=$(az account list-locations -o json | jq -r '.[] | select( .metadata.regionType != "Logical" ) | .name' | sort | grep -v -E "(${BLACKLISTED_TARGET_REGIONS// /|})" | tr '\n' ' ')
67+
TARGET_REGIONS="westindia westeurope"
6668
}
6769

6870
function ensure-vhd-uri-exists() {
@@ -134,7 +136,7 @@ function sig-image-version-update-regions() {
134136
--gallery-name "${FLATCAR_GALLERY_NAME}" \
135137
--gallery-image-definition "${FLATCAR_GALLERY_IMAGE_NAME}" \
136138
--gallery-image-version "${FLATCAR_GALLERY_VERSION}" \
137-
--target-regions "${TARGET_REGIONS}"
139+
--target-regions ${TARGET_REGIONS}
138140
}
139141

140142
function ensure-image-definition() {

0 commit comments

Comments
 (0)