talos/hack/test/e2e-azure.sh
Spencer Smith 7b4633b35d chore: update CI scripts
This PR pulls in the latest version of our CAPI providers, as well as
makes some minor tweaks to our bash scripts to disable terminal output
of commands during certain actions.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-10-22 09:00:41 -07:00

46 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -eou pipefail
source ./hack/test/e2e.sh
function setup {
AZURE_STORAGE_ACCOUNT=talostesting
AZURE_STORAGE_CONTAINER=talostesting
AZURE_GROUP=talos
# Setup svc acct vars
set +x
echo ${AZURE_SVC_ACCT} | base64 -d > ${TMP}/svc-acct.json
AZURE_CLIENT_ID="$( cat ${TMP}/svc-acct.json | jq -r '.clientId' )"
AZURE_CLIENT_SECRET="$( cat ${TMP}/svc-acct.json | jq -r '.clientSecret' )"
AZURE_TENANT_ID="$( cat ${TMP}/svc-acct.json | jq -r '.tenantId' )"
# Login to azure
az login --service-principal --username ${AZURE_CLIENT_ID} --password ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} > /dev/null
set -x
# Untar image
tar -C ${TMP} -xf ${ARTIFACTS}/azure.tar.gz
# Get connection string
AZURE_STORAGE_CONNECTION_STRING=$(az storage account show-connection-string -n ${AZURE_STORAGE_ACCOUNT} -g ${AZURE_GROUP} -o tsv)
# Push blob
AZURE_STORAGE_CONNECTION_STRING="${AZURE_STORAGE_CONNECTION_STRING}" az storage blob upload --container-name ${AZURE_STORAGE_CONTAINER} -f ${TMP}/disk.vhd -n azure-${TAG}.vhd
# Delete image
az image delete --name talos-e2e-${TAG} -g ${AZURE_GROUP}
# Create image
az image create --name talos-e2e-${TAG} --source https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_STORAGE_CONTAINER}/azure-${TAG}.vhd --os-type linux -g ${AZURE_GROUP}
# Setup the cluster YAML.
sed "s/{{TAG}}/${TAG}/" ${PWD}/hack/test/manifests/azure-cluster.yaml > ${TMP}/cluster.yaml
}
setup
create_cluster_capi azure
run_talos_integration_test
run_kubernetes_integration_test