Appended testing_job_id changed by repo_environment

This commit is contained in:
Jose Luis Carrillo Aguilar 2022-10-08 14:23:37 +02:00
Родитель fe5ee12f54
Коммит 90bab4ed55
1 изменённых файлов: 6 добавлений и 6 удалений

12
.github/workflows/IaC-terraform-AKS.yml поставляемый
Просмотреть файл

@ -36,7 +36,7 @@ env:
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_PARTNER_ID: "451dc593-a3a3-4d41-91e7-3aadf93e1a78"
ENVIRONMENT: "1${{ github.run_id }}"
ENVIRONMENT: "1${{ github.repository }}/{{ github.ref_name }}-${{ github.event.inputs.ENVIRONMENT }}"
TF_BACKEND_RSG: "rg-enterprise-tf-dependencies"
TF_VERSION: "1.3.1"
AZ_CLI_VERSION: "2.39.0" # Please do not upgrade until https://github.com/Azure/azure-cli/issues/24029 is solved
@ -109,7 +109,7 @@ jobs:
else
./terraform init -upgrade
fi
eval ./terraform plan ${parameter_files} -var tags='{testing_job_id='"$ENVIRONMENT"'}' -out tfdeployplan
eval ./terraform plan ${parameter_files} -var tags='{repo_environment='"$ENVIRONMENT"'}' -out tfdeployplan
- name: Deploy Standalone
if: ${{ github.event.inputs.DEPLOY == 'true' }}
@ -144,7 +144,7 @@ jobs:
else
./terraform init -upgrade
fi
eval ./terraform plan ${parameter_files} -var tags='{testing_job_id='"$ENVIRONMENT"'}' -destroy -out tfdestroyplan
eval ./terraform plan ${parameter_files} -var tags='{repo_environment='"$ENVIRONMENT"'}' -destroy -out tfdestroyplan
- name: Destroy Standalone
if: ${{ github.event.inputs.DESTROY == 'true' }}
@ -160,12 +160,12 @@ jobs:
- name: Complete purge
if: ${{ github.event.inputs.DESTROY == 'true' }}
run: |
echo RunId $ENVIRONMENT
echo RepoEnvironment $ENVIRONMENT
for i in `az monitor diagnostic-settings subscription list -o tsv --query "value[?contains(name, '$ENVIRONMENT' )].name"`; do echo "purging subscription diagnostic-settings: $i" && $(az monitor diagnostic-settings subscription delete --name $i --yes); done
for i in `az monitor log-profiles list -o tsv --query '[].name'`; do az monitor log-profiles delete --name $i; done
# for i in `az ad group list --query "[?contains(displayName, '$ENVIRONMENT')].objectId" -o tsv`; do echo "purging Azure AD group: $i" && $(az ad group delete --verbose --group $i || true); done
# for i in `az ad app list --query "[?contains(displayName, '$ENVIRONMENT')].appId" -o tsv`; do echo "purging Azure AD app: $i" && $(az ad app delete --verbose --id $i || true); done
for i in `az keyvault list-deleted --query "[?tags.testing_job_id=='$ENVIRONMENT'].name" -o tsv`; do az keyvault purge --name $i; done
for i in `az group list --query "[?tags.testing_job_id=='$ENVIRONMENT'].name" -o tsv`; do echo "purging resource group: $i" && $(az group delete -n $i -y --no-wait || true); done
for i in `az keyvault list-deleted --query "[?tags.repo_environment=='$ENVIRONMENT'].name" -o tsv`; do az keyvault purge --name $i; done
for i in `az group list --query "[?tags.repo_environment=='$ENVIRONMENT'].name" -o tsv`; do echo "purging resource group: $i" && $(az group delete -n $i -y --no-wait || true); done
for i in `az role assignment list --query "[?contains(roleDefinitionName, '$ENVIRONMENT')].roleDefinitionName" -o tsv`; do echo "purging role assignment: $i" && $(az role assignment delete --role $i || true); done
for i in `az role definition list --query "[?contains(roleName, '$ENVIRONMENT')].roleName" -o tsv`; do echo "purging custom role definition: $i" && $(az role definition delete --name $i || true); done