From 998c7e093922298637e7c7e82e25cee7d336144d Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Mon, 9 Feb 2015 16:42:33 -0800 Subject: [PATCH] oem/azure: set more image metadata --- ...et-image-icon.sh => set-image-metadata.sh} | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) rename oem/azure/{set-image-icon.sh => set-image-metadata.sh} (51%) diff --git a/oem/azure/set-image-icon.sh b/oem/azure/set-image-metadata.sh similarity index 51% rename from oem/azure/set-image-icon.sh rename to oem/azure/set-image-metadata.sh index 130e878105..de0297cf7c 100755 --- a/oem/azure/set-image-icon.sh +++ b/oem/azure/set-image-metadata.sh @@ -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 " + echo "Usage: $0 []" 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="${label} ${image_name} + ${description} + ${image_family} + ${published_date} ${ICON} + ${RECOMMENDED_VM_SIZE} ${SMALL_ICON} " 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 \