diff --git a/oem/azure/common.sh b/oem/azure/common.sh deleted file mode 100644 index 666e30248e..0000000000 --- a/oem/azure/common.sh +++ /dev/null @@ -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 -} diff --git a/oem/azure/publish.sh b/oem/azure/publish.sh deleted file mode 100755 index ab9b43f41d..0000000000 --- a/oem/azure/publish.sh +++ /dev/null @@ -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 []" - 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}" diff --git a/oem/azure/replicate-image.sh b/oem/azure/replicate-image.sh deleted file mode 100755 index 4e20629602..0000000000 --- a/oem/azure/replicate-image.sh +++ /dev/null @@ -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 " - exit 2 -fi - -image_name="CoreOS-${GROUP}-${VERSION}" - -subscription_id=$SUBSCRIPTION_ID -if [ -z $subscription_id ]; then - subscription_id=$(getSubscriptionId) -fi - -IFS=$'\n' -requestBody=" - " -for region in $(getRegions); do - requestBody+="\n\t\t$region" -done -requestBody+=" - - - CoreOS - ${GROUP} - ${VERSION} - -" -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 diff --git a/oem/azure/set-image-metadata.sh b/oem/azure/set-image-metadata.sh deleted file mode 100755 index 3baf881ec3..0000000000 --- a/oem/azure/set-image-metadata.sh +++ /dev/null @@ -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 []" - 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=" - - - ${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 - -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 diff --git a/oem/azure/share-image.sh b/oem/azure/share-image.sh deleted file mode 100755 index 155cc2adf0..0000000000 --- a/oem/azure/share-image.sh +++ /dev/null @@ -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 " - 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 diff --git a/oem/azure/unreplicate-image.sh b/oem/azure/unreplicate-image.sh deleted file mode 100755 index 1a211b951d..0000000000 --- a/oem/azure/unreplicate-image.sh +++ /dev/null @@ -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 " - 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