1313 - demo
1414 workflow_dispatch :
1515 inputs :
16+ resource_group_name :
17+ description : ' Resource Group name (optional)'
18+ required : false
19+ default : ' '
20+ type : string
1621 run_e2e_tests :
17- description : ' Run end -to-end tests'
22+ description : ' Run End -to-End tests'
1823 required : false
1924 default : true
2025 type : boolean
4449 default : ' '
4550 type : string
4651 existing_webapp_url :
47- description : ' Existing WebApp URL'
52+ description : ' Existing WebApp URL (Skips deployment) '
4853 required : false
4954 default : ' '
5055 type : string
5358 required : false
5459 default : false
5560 type : boolean
61+
5662 schedule :
5763 - cron : ' 0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
5864env :
@@ -308,12 +314,18 @@ jobs:
308314 - name : Generate Resource Group Name
309315 id : generate_rg_name
310316 run : |
311- echo "Generating a unique resource group name..."
312- ACCL_NAME="docgen" # Account name as specified
313- SHORT_UUID=$(uuidgen | cut -d'-' -f1)
314- UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
315- echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
316- echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
317+ # Check if a resource group name was provided as input
318+ if [[ -n "${{ github.event.inputs.resource_group_name }}" ]]; then
319+ echo "Using provided Resource Group name: ${{ github.event.inputs.resource_group_name }}"
320+ echo "RESOURCE_GROUP_NAME=${{ github.event.inputs.resource_group_name }}" >> $GITHUB_ENV
321+ else
322+ echo "Generating a unique resource group name..."
323+ ACCL_NAME="docgen" # Account name as specified
324+ SHORT_UUID=$(uuidgen | cut -d'-' -f1)
325+ UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
326+ echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
327+ echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
328+ fi
317329
318330 - name : Setup Azure Developer CLI
319331 run : |
@@ -333,13 +345,14 @@ jobs:
333345 id : check_create_rg
334346 run : |
335347 set -e
336- echo "Checking if resource group exists..."
348+ echo "🔍 Checking if resource group '$RESOURCE_GROUP_NAME' exists..."
337349 rg_exists=$(az group exists --name $RESOURCE_GROUP_NAME)
338350 if [ "$rg_exists" = "false" ]; then
339- echo "Resource group does not exist. Creating..."
340- az group create --name $RESOURCE_GROUP_NAME --location $AZURE_LOCATION || { echo "Error creating resource group"; exit 1; }
351+ echo "📦 Resource group does not exist. Creating new resource group '$RESOURCE_GROUP_NAME' in location '$AZURE_LOCATION'..."
352+ az group create --name $RESOURCE_GROUP_NAME --location $AZURE_LOCATION || { echo "❌ Error creating resource group"; exit 1; }
353+ echo "✅ Resource group '$RESOURCE_GROUP_NAME' created successfully."
341354 else
342- echo "Resource group already exists."
355+ echo "✅ Resource group '$RESOURCE_GROUP_NAME' already exists. Deploying to existing resource group ."
343356 fi
344357 echo "RESOURCE_GROUP_NAME=$RESOURCE_GROUP_NAME" >> $GITHUB_OUTPUT
345358
@@ -708,13 +721,6 @@ jobs:
708721 az acr repository delete --name $(echo "${{ secrets.ACR_TEST_LOGIN_SERVER }}" | cut -d'.' -f1) \
709722 --image webapp:$IMAGE_TAG --yes || echo "Warning: Failed to delete main image or image not found"
710723
711- # Delete the image with run number suffix (only if it was a custom build)
712- if [[ "${{ needs.docker-build.result }}" == "success" ]]; then
713- echo "Deleting image: ${{ secrets.ACR_TEST_LOGIN_SERVER }}/webapp:${IMAGE_TAG}_${{ github.run_number }}"
714- az acr repository delete --name $(echo "${{ secrets.ACR_TEST_LOGIN_SERVER }}" | cut -d'.' -f1) \
715- --image webapp:${IMAGE_TAG}_${{ github.run_number }} --yes || echo "Warning: Failed to delete run-numbered image or image not found"
716- fi
717-
718724 echo "✅ Docker images cleanup completed"
719725 else
720726 echo "⚠️ Skipping Docker image cleanup (using standard branch image: $IMAGE_TAG)"
0 commit comments