Merge branch 'feature/create-self-hosted-runner' of github.com:zenml-… #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Destroy the test runner vm to azure | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
jobs: | ||
destroy_test_vm: | ||
name: Destroy VM to azure | ||
runs-on: ubuntu-latest | ||
env: | ||
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | ||
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | ||
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | ||
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | ||
MLSTACKS_ANALYTICS_OPT_IN=false | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
defaults: | ||
run: | ||
working-directory: ./infrastructure | ||
steps: | ||
- name: Checkout the Code | ||
uses: actions/checkout@v3 | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
- name: Terraform fmt | ||
id: fmt | ||
run: terraform fmt -check | ||
continue-on-error: true | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
- name: Terraform Validate | ||
id: validate | ||
run: terraform validate -no-color | ||
- name: Delete blob | ||
run: | | ||
az storage blob delete --account-name zenmlstorageaccount --container-name github-runner-tf --name ${{ github.run_id }} | ||
- name: Check if any blobs left | ||
id: check_blobs | ||
run: | | ||
blobs=$(az storage blob list --account-name zenmlstorageaccount --container-name github-runner-tf --prefix github-run --output tsv) | ||
echo "BLOBS=$blobs" >> $GITHUB_ENV | ||
- name: Destroy VM | ||
run: terraform destroy -auto-approve -refresh=False | ||
env: | ||
TF_VAR_github_runner_token: ${{ secrets.runner_token }} | ||
if: env.BLOBS == '' |