mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 14:06:58 +02:00
Merge pull request #556 from crawford/publish
oem/azure: make compatible with multiple regions
This commit is contained in:
commit
93fc3cad4b
@ -1,35 +1,27 @@
|
|||||||
AZURE_ENVIRONMENT=AzureCloud
|
getAzureEnvironment() {
|
||||||
REGIONS=(
|
azure account show --json | \
|
||||||
"West Europe"
|
jq '.[0].environmentName' --raw-output
|
||||||
"North Europe"
|
}
|
||||||
"East Asia"
|
|
||||||
"Southeast Asia"
|
|
||||||
"East US"
|
|
||||||
"West US"
|
|
||||||
"Japan East"
|
|
||||||
"Japan West"
|
|
||||||
"Central US"
|
|
||||||
"East US 2"
|
|
||||||
"Brazil South"
|
|
||||||
"North Central US"
|
|
||||||
"South Central US"
|
|
||||||
"Australia East"
|
|
||||||
"Australia Southeast"
|
|
||||||
"Central India"
|
|
||||||
"West India"
|
|
||||||
"South India"
|
|
||||||
"Canada Central"
|
|
||||||
"Canada East"
|
|
||||||
"UK North"
|
|
||||||
"UK South 2"
|
|
||||||
)
|
|
||||||
|
|
||||||
getManagementEndpoint() {
|
getManagementEndpoint() {
|
||||||
azure account env show --environment=$AZURE_ENVIRONMENT --json | \
|
azure account env show --environment=$(getAzureEnvironment) --json | \
|
||||||
jq '.managementEndpointUrl' --raw-output
|
jq '.managementEndpointUrl' --raw-output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStorageEndpointPrefix() {
|
||||||
|
azure account env show --environment=$(getAzureEnvironment) --json | \
|
||||||
|
jq '.storageEndpointSuffix' --raw-output
|
||||||
|
}
|
||||||
|
|
||||||
|
getBlobStorageEndpoint() {
|
||||||
|
echo "blob$(getStorageEndpointPrefix)"
|
||||||
|
}
|
||||||
|
|
||||||
getSubscriptionId() {
|
getSubscriptionId() {
|
||||||
azure account show --json | \
|
azure account show --json | \
|
||||||
jq '.[0].id' --raw-output
|
jq '.[0].id' --raw-output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRegions() {
|
||||||
|
azure vm location list --json | jq '.[].name' --raw-output
|
||||||
|
}
|
||||||
|
@ -61,7 +61,7 @@ azure storage blob copy start \
|
|||||||
|
|
||||||
echo "Creating Azure image from blob..."
|
echo "Creating Azure image from blob..."
|
||||||
azure vm image create \
|
azure vm image create \
|
||||||
--blob-url="https://coreos.blob.core.windows.net/publish/coreos-${VERSION}-${LGROUP}.vhd" \
|
--blob-url="https://coreos.$(getBlobStorageEndpoint)/publish/coreos-${VERSION}-${LGROUP}.vhd" \
|
||||||
--os="linux" \
|
--os="linux" \
|
||||||
--label="CoreOS ${UGROUP}" \
|
--label="CoreOS ${UGROUP}" \
|
||||||
"CoreOS-${UGROUP}-${VERSION}"
|
"CoreOS-${UGROUP}-${VERSION}"
|
||||||
|
@ -27,7 +27,7 @@ fi
|
|||||||
|
|
||||||
requestBody="<ReplicationInput xmlns=\"http://schemas.microsoft.com/windowsazure\">
|
requestBody="<ReplicationInput xmlns=\"http://schemas.microsoft.com/windowsazure\">
|
||||||
<TargetLocations>"
|
<TargetLocations>"
|
||||||
for region in "${REGIONS[@]}"; do
|
for region in $(getRegions); do
|
||||||
requestBody+="\n\t\t<Region>$region</Region>"
|
requestBody+="\n\t\t<Region>$region</Region>"
|
||||||
done
|
done
|
||||||
requestBody+="
|
requestBody+="
|
||||||
|
Loading…
Reference in New Issue
Block a user