oem/azure: Drop scripts obsoleted by plume

This commit is contained in:
Benjamin Gilbert 2017-05-15 12:07:15 -07:00
parent ea0e8fd583
commit 7ac67b7c97
6 changed files with 0 additions and 362 deletions

View File

@ -1,28 +0,0 @@
getAzureEnvironment() {
azure account show --json | \
jq '.[0].environmentName' --raw-output
}
getManagementEndpoint() {
azure account env show --environment=$(getAzureEnvironment) --json | \
jq '.managementEndpointUrl' --raw-output
}
getStorageEndpointPrefix() {
prefix=$(azure account env show --environment=$(getAzureEnvironment) --json | \
jq '.storageEndpointSuffix' --raw-output)
echo "${prefix##.}"
}
getBlobStorageEndpoint() {
echo "blob.$(getStorageEndpointPrefix)"
}
getSubscriptionId() {
azure account show --json | \
jq '.[0].id' --raw-output
}
getRegions() {
azure vm location list --json | jq '.[].name' --raw-output
}

View File

@ -1,73 +0,0 @@
#!/usr/bin/env bash
# This script will copy the Azure image from the CoreOS build bucket into
# Azure storage, create an Azure VM image, and replicate it to all regions. It
# 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
set -e
WORKDIR=$(mktemp --directory --tmpdir=/var/tmp)
trap "rm --force --recursive ${WORKDIR}" SIGINT SIGTERM EXIT
IMAGE_PATH="${WORKDIR}/coreos_production_azure_image.vhd"
UGROUP="${1^}"
LGROUP="${1,}"
VERSION=$2
DATE=$3
GS_BUCKET_URL="gs://builds.release.core-os.net/${LGROUP}/boards/amd64-usr/${VERSION}/coreos_production_azure_image.vhd"
if [[ -z $UGROUP || -z $VERSION ]]; then
echo "Usage: $0 <group> <version> [<published date>]"
exit 2
fi
echo "Downloading image from CoreOS build bucket..."
gsutil cp "${GS_BUCKET_URL}.bz2" "${IMAGE_PATH}.bz2"
gsutil cp "${GS_BUCKET_URL}.bz2.sig" "${IMAGE_PATH}.bz2.sig"
gpg --verify "${IMAGE_PATH}.bz2.sig"
echo "Unzipping image..."
bunzip2 "${IMAGE_PATH}.bz2"
echo "Inflating image..."
qemu-img convert -f vpc -O raw "${IMAGE_PATH}" "${IMAGE_PATH}.bin"
qemu-img convert -f raw -o subformat=fixed -O vpc "${IMAGE_PATH}.bin" "${IMAGE_PATH}"
echo "Fetching Azure storage account key..."
ACCOUNT_KEY=$(azure storage account keys list coreos --json | \
jq '.primaryKey' --raw-output)
echo "Uploading image as page blob into Azure..."
azure storage blob upload \
--account-name="coreos" \
--account-key="${ACCOUNT_KEY}" \
--file="${IMAGE_PATH}" \
--container="publish" \
--blob="coreos-${VERSION}-${LGROUP}.vhd" \
--blobtype="Page"
azure storage blob copy start \
--account-name="coreos" \
--account-key="${ACCOUNT_KEY}" \
--source-blob="coreos-${VERSION}-${LGROUP}.vhd" \
--source-container="publish" \
--dest-container="pre-publish"
echo "Creating Azure image from blob..."
azure vm image create \
--blob-url="https://coreos.$(getBlobStorageEndpoint)/publish/coreos-${VERSION}-${LGROUP}.vhd" \
--os="linux" \
--label="CoreOS ${UGROUP}" \
"CoreOS-${UGROUP}-${VERSION}"
echo "Setting image metadata..."
$DIR/set-image-metadata.sh "${UGROUP}" "${VERSION}" "${DATE}"
echo "Requesting image replication..."
$DIR/replicate-image.sh "${UGROUP}" "${VERSION}"

View File

@ -1,67 +0,0 @@
#!/usr/bin/env bash
# This script will replicate the given image into all Azure regions. 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
set -e
GROUP="${1^}"
VERSION=$2
if [[ -z $GROUP || -z $VERSION ]]; then
echo "Usage: $0 <group> <version>"
exit 2
fi
image_name="CoreOS-${GROUP}-${VERSION}"
subscription_id=$SUBSCRIPTION_ID
if [ -z $subscription_id ]; then
subscription_id=$(getSubscriptionId)
fi
IFS=$'\n'
requestBody="<ReplicationInput xmlns=\"http://schemas.microsoft.com/windowsazure\">
<TargetLocations>"
for region in $(getRegions); do
requestBody+="\n\t\t<Region>$region</Region>"
done
requestBody+="
</TargetLocations>
<ComputeImageAttributes>
<Offer>CoreOS</Offer>
<Sku>${GROUP}</Sku>
<Version>${VERSION}</Version>
</ComputeImageAttributes>
</ReplicationInput>"
unset IFS
url="$(getManagementEndpoint)/${subscription_id}/services/images/${image_name}/replicate"
workdir=$(mktemp --directory)
trap "rm --force --recursive ${workdir}" SIGINT SIGTERM EXIT
azure account cert export \
--file="${workdir}/cert" \
--subscription="${subscription_id}" > /dev/null
result=$(echo -e "${requestBody}" | curl \
--silent \
--request PUT \
--header "x-ms-version: 2015-04-01" \
--header "Content-Type: application/xml" \
--cert "${workdir}/cert" \
--url "${url}" \
--write-out "%{http_code}" \
--output "${workdir}/out" \
--data-binary @-)
if [[ $result != 200 ]]; then
echo "${result} - $(< ${workdir}/out)"
exit 1
fi

View File

@ -1,92 +0,0 @@
#!/usr/bin/env bash
# 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
set -e
# These icon names are effectively magic constants. At some point, these assets
# were given to an Azure team and they uploaded them into their system.
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> [<published date>]"
exit 2
fi
image_name="CoreOS-${GROUP}-${VERSION}"
label="CoreOS ${GROUP}"
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
subscription_id=$(getSubscriptionId)
fi
requestBody="<OSImage xmlns=\"http://schemas.microsoft.com/windowsazure\"
xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
<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
result=$(echo "${requestBody}" | curl \
--silent \
--request PUT \
--header "x-ms-version: 2013-08-01" \
--header "Content-Type: application/xml" \
--cert "${workdir}/cert" \
--url "${url}" \
--write-out "%{http_code}" \
--output "${workdir}/out" \
--data-binary @-)
if [[ $result != 200 ]]; then
echo "${result} - $(< ${workdir}/out)"
exit 1
fi

View File

@ -1,51 +0,0 @@
#!/usr/bin/env bash
# This script will replicate the given image into all Azure regions. 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
set -e
GROUP="${1^}"
VERSION=$2
if [[ -z $GROUP || -z $VERSION ]]; then
echo "Usage: $0 <group> <version>"
exit 2
fi
image_name="CoreOS-${GROUP}-${VERSION}"
subscription_id=$SUBSCRIPTION_ID
if [ -z $subscription_id ]; then
subscription_id=$(getSubscriptionId)
fi
url="$(getManagementEndpoint)/${subscription_id}/services/images/${image_name}/share?permission=public"
workdir=$(mktemp --directory)
trap "rm --force --recursive ${workdir}" SIGINT SIGTERM EXIT
azure account cert export \
--file="${workdir}/cert" \
--subscription="${subscription_id}" > /dev/null
result=$(curl \
--silent \
--request PUT \
--header "x-ms-version: 2014-10-01" \
--header "Content-Type: application/xml" \
--header "Content-Length: 0" \
--cert "${workdir}/cert" \
--url "${url}" \
--write-out "%{http_code}" \
--output "${workdir}/out")
if [[ $result != 200 ]]; then
echo "${result} - $(< ${workdir}/out)"
exit 1
fi

View File

@ -1,51 +0,0 @@
#!/usr/bin/env bash
# This script will un-replicate the given image. 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
set -e
GROUP="${1^}"
VERSION=$2
if [[ -z $GROUP || -z $VERSION ]]; then
echo "Usage: $0 <group> <version>"
exit 2
fi
image_name="CoreOS-${GROUP}-${VERSION}"
subscription_id=$SUBSCRIPTION_ID
if [ -z $subscription_id ]; then
subscription_id=$(getSubscriptionId)
fi
url="$(getManagementEndpoint)/${subscription_id}/services/images/${image_name}/unreplicate"
workdir=$(mktemp --directory)
trap "rm --force --recursive ${workdir}" SIGINT SIGTERM EXIT
azure account cert export \
--file="${workdir}/cert" \
--subscription="${subscription_id}" > /dev/null
result=$(curl \
--silent \
--request PUT \
--header "x-ms-version: 2014-10-01" \
--header "Content-Type: application/xml" \
--header "Content-Length: 0" \
--cert "${workdir}/cert" \
--url "${url}" \
--write-out "%{http_code}" \
--output "${workdir}/out")
if [[ $result != 200 ]]; then
echo "${result} - $(< ${workdir}/out)"
exit 1
fi