diff --git a/.github/workflows/azure-dev-down.yml b/.github/workflows/azure-dev-down.yml index 62c92316..e8f2889b 100644 --- a/.github/workflows/azure-dev-down.yml +++ b/.github/workflows/azure-dev-down.yml @@ -71,7 +71,7 @@ jobs: RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }} RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }} RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }} - + shell: bash run: | azd config set auth.useAzCliAuth "true" @@ -82,9 +82,15 @@ jobs: azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER" azd env set RESOURCE_TAGS "$RESOURCE_TAGS" - azd package # trigger prepackage hook to setup terraform provider - azd provision --preview # https://github.com/Azure/azure-dev/issues/4317 - azd down --no-prompt --force --purge + # Detect if debug logging is enabled and set DEBUG_FLAG accordingly + DEBUG_FLAG="" + if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then + DEBUG_FLAG="--debug" + fi + + azd package $DEBUG_FLAG # trigger prepackage hook to setup terraform provider + azd provision --preview $DEBUG_FLAG # https://github.com/Azure/azure-dev/issues/4317 + azd down --no-prompt --force --purge $DEBUG_FLAG - name: Purge Soft-Deleted Azure OpenAI Resources shell: bash @@ -97,7 +103,7 @@ jobs: # Only attempt to purge if we have the required information if [[ -n "$OPENAI_RESOURCE_NAME" && -n "$AZURE_REGION" ]]; then echo "Attempting to purge soft-deleted Azure OpenAI resource: $OPENAI_RESOURCE_NAME in $AZURE_REGION" - + # Purge the soft-deleted Cognitive Services account (continue on error if resource not found) az cognitiveservices account purge \ --location "$AZURE_REGION" \ @@ -105,5 +111,4 @@ jobs: --name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged" else echo "OpenAI resource information not found in environment outputs. Skipping purge." - fi - + fi \ No newline at end of file diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index d96c4d86..76047f3a 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -57,7 +57,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -67,17 +67,17 @@ jobs: version: '1.20.0' # Specify your desired azd version here - name: Setup Node.js - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: '18.x' - name: Install Terraform - uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0 + uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0 with: terraform_version: 1.13.3 - name: Install TFLint - uses: terraform-linters/setup-tflint@b480b8fcdaa6f2c577f8e4fa799e89e756bb7c93 # v6.2.2 + uses: terraform-linters/setup-tflint@b480b8fcdaa6f2c577f8e4fa799e89e756bb7c93 # v6.2.2 with: tflint_version: v0.58.1 github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate @@ -131,7 +131,7 @@ jobs: pac help - name: Set Up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0 with: python-version: "3.x" @@ -139,7 +139,7 @@ jobs: run: pip install checkov - name: Login to Azure with Federated Identity - uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 + uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 with: client-id: ${{ vars.AZURE_CLIENT_ID }} tenant-id: ${{ vars.AZURE_TENANT_ID }} @@ -190,9 +190,14 @@ jobs: azd env set GITHUB_RUNNER_IMAGE_TAG "$GITHUB_RUNNER_IMAGE_TAG" azd env set GITHUB_RUNNER_IMAGE_BRANCH "$GITHUB_RUNNER_IMAGE_BRANCH" - azd provision --no-prompt + # Detect if debug logging is enabled and set DEBUG_FLAG accordingly + DEBUG_FLAG="" + if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then + DEBUG_FLAG="--debug" + fi + azd provision --no-prompt $DEBUG_FLAG - - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 if: success() || failure() with: name: sarif-reports @@ -241,7 +246,13 @@ jobs: azd env set RESOURCE_TAGS "$RESOURCE_TAGS" azd env select "$AZURE_ENV_NAME" - azd down --no-prompt --force --purge + + # Detect if debug logging is enabled and set DEBUG_FLAG accordingly + DEBUG_FLAG="" + if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then + DEBUG_FLAG="--debug" + fi + azd down --no-prompt --force --purge $DEBUG_FLAG - name: Purge Soft-Deleted Azure OpenAI Resources if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }} @@ -263,4 +274,4 @@ jobs: --name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged" else echo "OpenAI resource information not found in environment outputs. Skipping purge." - fi + fi \ No newline at end of file