mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
oem/azure: set more image metadata
This commit is contained in:
parent
f60f0631bf
commit
998c7e0939
@ -1,9 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script will set the icon for the specified OS image to the CoreOS logo.
|
||||
# It needs to be run in an environment where the azure-xplat-cli has been
|
||||
# installed and configured with the production credentials and (optionally)
|
||||
# SUBSCRIPTION_ID is defined, containing the subscription GUID.
|
||||
# This script will set the icon, recommended VM size, and optionally the
|
||||
# publication date for the specified OS image to the CoreOS logo. It needs to
|
||||
# be run in an environment where the azure-xplat-cli has been installed and
|
||||
# configured with the production credentials and (optionally) SUBSCRIPTION_ID
|
||||
# is defined, containing the subscription GUID.
|
||||
|
||||
DIR=$(dirname $0)
|
||||
. $DIR/common.sh
|
||||
@ -15,17 +16,37 @@ set -e
|
||||
ICON="coreos-globe-color-lg-100px.png"
|
||||
SMALL_ICON="coreos-globe-color-lg-45px.png"
|
||||
|
||||
RECOMMENDED_VM_SIZE="Medium"
|
||||
|
||||
GROUP="${1^}"
|
||||
VERSION=$2
|
||||
DATE=$3
|
||||
|
||||
if [[ -z $GROUP || -z $VERSION ]]; then
|
||||
echo "Usage: $0 <group> <version>"
|
||||
echo "Usage: $0 <group> <version> [<published date>]"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
image_name="CoreOS-${GROUP}-${VERSION}"
|
||||
label="CoreOS ${GROUP}"
|
||||
workdir=$(mktemp --directory)
|
||||
image_family=$label
|
||||
published_date=$(date --date="${DATE}" --rfc-3339=date)
|
||||
description=""
|
||||
case $GROUP in
|
||||
Alpha)
|
||||
description="The Alpha channel closely tracks current development work and is released frequently. The newest versions of docker, etcd and fleet will be available for testing."
|
||||
;;
|
||||
Beta)
|
||||
description="The Beta channel consists of promoted Alpha releases. Mix a few Beta machines into your production clusters to catch any bugs specific to your hardware or configuration."
|
||||
;;
|
||||
Stable)
|
||||
description="The Stable channel should be used by production clusters. Versions of CoreOS are battle-tested within the Beta and Alpha channels before being promoted."
|
||||
;;
|
||||
*)
|
||||
echo "Invalid group \"${1}\""
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
subscription_id=$SUBSCRIPTION_ID
|
||||
if [ -z $subscription_id ]; then
|
||||
@ -37,18 +58,23 @@ requestBody="<OSImage xmlns=\"http://schemas.microsoft.com/windowsazure\"
|
||||
|
||||
<Label>${label}</Label>
|
||||
<Name>${image_name}</Name>
|
||||
<Description>${description}</Description>
|
||||
<ImageFamily>${image_family}</ImageFamily>
|
||||
<PublishedDate>${published_date}</PublishedDate>
|
||||
<IconUri>${ICON}</IconUri>
|
||||
<RecommendedVMSize>${RECOMMENDED_VM_SIZE}</RecommendedVMSize>
|
||||
<SmallIconUri>${SMALL_ICON}</SmallIconUri>
|
||||
</OSImage>"
|
||||
|
||||
url="$(getManagementEndpoint)/${subscription_id}/services/images/${image_name}"
|
||||
|
||||
workdir=$(mktemp --directory)
|
||||
trap "rm --force --recursive ${workdir}" SIGINT SIGTERM EXIT
|
||||
|
||||
azure account cert export \
|
||||
--file="${workdir}/cert" \
|
||||
--subscription="${subscription_id}" > /dev/null
|
||||
|
||||
trap "rm --force --recursive ${workdir}" SIGINT SIGTERM EXIT
|
||||
|
||||
result=$(echo "${requestBody}" | curl \
|
||||
--silent \
|
||||
--request PUT \
|
||||
Loading…
x
Reference in New Issue
Block a user