Fixes cleanup.sh (#50)
This commit is contained in:
Родитель
db9be0d2a3
Коммит
50e792483e
|
@ -64,14 +64,21 @@ if [[ ! -z "$PRE_PROVISIONED_BATCH_ACCOUNT_NAME" ]] && [ "${NO_BATCH_ACCOUNT_POO
|
|||
BATCH_ACCOUNT_ID=$(az batch account list --query "[?name == '${PRE_PROVISIONED_BATCH_ACCOUNT_NAME}'].id" -o tsv)
|
||||
BATCH_ACCOUNT_RG_NAME=$(az resource show --ids ${BATCH_ACCOUNT_ID} --query resourceGroup -o tsv)
|
||||
AZURE_BATCH_ACCESS_KEY=$(az batch account keys list --name ${PRE_PROVISIONED_BATCH_ACCOUNT_NAME} --resource-group ${BATCH_ACCOUNT_RG_NAME} | jq ".primary")
|
||||
AZURE_BATCH_ENDPOINT=$(az batch account show --name ${PRE_PROVISIONED_BATCH_ACCOUNT_NAME} --resource-group ${BATCH_ACCOUNT_RG_NAME} --query accountEndpoint -o tsv)
|
||||
|
||||
set -x
|
||||
echo "Cleaning the batch job: ${BATCH_ACCOUNT_POOL_NAME}"
|
||||
az batch job delete --yes \
|
||||
--job-id ${BATCH_ACCOUNT_POOL_NAME}
|
||||
--job-id ${BATCH_ACCOUNT_POOL_NAME} \
|
||||
--account-endpoint ${AZURE_BATCH_ENDPOINT} \
|
||||
--account-key ${AZURE_BATCH_ACCESS_KEY} \
|
||||
--account-name ${PRE_PROVISIONED_BATCH_ACCOUNT_NAME}
|
||||
if [[ $? == 0 ]]; then
|
||||
echo "Cleanup the batch pool: ${BATCH_ACCOUNT_POOL_NAME}"
|
||||
az batch pool delete --yes \
|
||||
--pool-id ${BATCH_ACCOUNT_POOL_NAME}
|
||||
--pool-id ${BATCH_ACCOUNT_POOL_NAME} \
|
||||
--account-endpoint ${AZURE_BATCH_ENDPOINT} \
|
||||
--account-key ${AZURE_BATCH_ACCESS_KEY} \
|
||||
--account-name ${PRE_PROVISIONED_BATCH_ACCOUNT_NAME}
|
||||
|
||||
fi
|
||||
fi
|
Загрузка…
Ссылка в новой задаче