Skip to content

Azure Container Apps - Key Vault test #23

Azure Container Apps - Key Vault test

Azure Container Apps - Key Vault test #23

name: Azure Container Apps - Key Vault test
run-name: Azure Container Apps - Key Vault test
on:
schedule:
- cron: "15 06 * * 2" # <=== Change this value
workflow_dispatch:
env:
BadgeName: 'AzureContainerApps-KeyVault'
BadgeLabel: 'AzureContainerApps-KeyVault'
jobs:
RunTerraform:
uses: ./.github/workflows/terraform-aca-kv-execute.yml
with:
terraform_directory: './container_apps_key_vault/1_terraform'
backend_key: 'aca-keyvault-test'
secrets: inherit
ValidateAPI:
runs-on: ubuntu-latest
needs: RunTerraform
steps:
- name: test
run: echo "${{needs.RunTerraform.outputs.app_url}}"
- name: Run API Validation Script
env:
EXPECTED_RESPONSE: "text from secret: AzureWayRocks!"
run: |
#!/bin/bash
# Send a GET request to the API
RESPONSE=$(curl -s "${{needs.RunTerraform.outputs.app_url}}")
# Check if the response contains the expected text
if [[ "$RESPONSE" == *"$EXPECTED_RESPONSE"* ]]; then
echo "Success: The response contains the expected text."
else
echo "Error: The response does not contain the expected text."
echo "Received response: $RESPONSE"
exit 1
fi
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Build-A-Badge-Success
if: success()
uses: peterrhodesdev/build-a-badge@v1.3.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
filename: ${{ env.BadgeName}}
label: ${{ env.BadgeLabel }}
message: "build date: ${{ steps.date.outputs.date }}"
namedLogo: github
labelColor: "#008000"
color: "#3272d3"
- name: Build-A-Badge-Failure
if: failure()
uses: peterrhodesdev/build-a-badge@v1.3.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
filename: ${{ env.BadgeName}}
label: ${{ env.BadgeLabel }}
message: "build date: ${{ steps.date.outputs.date }}"
namedLogo: github
labelColor: "#FF0000"
color: "#3272d3"
RunDestroyTerraform:
needs: ValidateAPI
uses: ./.github/workflows/terraform-destroy.yml
with:
terraform_directory: './container_apps_key_vault/1_terraform'
backend_key: 'aca-keyvault-test'
secrets: inherit