2017-10-31 23:15:19 +03:00
|
|
|
#!/bin/bash
|
2019-04-08 22:57:20 +03:00
|
|
|
#
|
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
# Licensed under the MIT license.
|
|
|
|
|
2017-10-31 23:15:19 +03:00
|
|
|
if [ -z "$CLIENT_ID" ]; then
|
|
|
|
echo "must provide a CLIENT_ID env var"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$CLIENT_SECRET" ]; then
|
|
|
|
echo "must provide a CLIENT_SECRET env var"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$TENANT_ID" ]; then
|
|
|
|
echo "must provide a TENANT_ID env var"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$SUBSCRIPTION_ID" ]; then
|
|
|
|
echo "must provide a SUBSCRIPTION_ID env var"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
az login --service-principal \
|
|
|
|
--username "${CLIENT_ID}" \
|
|
|
|
--password "${CLIENT_SECRET}" \
|
|
|
|
--tenant "${TENANT_ID}" &>/dev/null
|
|
|
|
|
|
|
|
# set to the sub id we want to cleanup
|
2019-04-08 19:25:56 +03:00
|
|
|
az account set -s "$SUBSCRIPTION_ID"
|
2017-10-31 23:15:19 +03:00
|
|
|
|
2019-03-21 01:14:15 +03:00
|
|
|
python pkg/helpers/generate_azure_constants.py
|
2018-11-14 04:46:03 +03:00
|
|
|
git status | grep pkg/helpers/azureconst.go
|
2017-10-31 23:15:19 +03:00
|
|
|
exit_code=$?
|
|
|
|
if [ $exit_code -gt "0" ]; then
|
|
|
|
echo "No modifications found! Exiting 0"
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "File was modified! Exiting 1"
|
|
|
|
exit 1
|
2018-03-27 22:21:55 +03:00
|
|
|
fi
|