Skip to content

Commit 5a4f257

Browse files
Update Job execution condition
1 parent 5762a0e commit 5a4f257

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

.github/workflows/deploy-Parameterized.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ on:
5454
default: false
5555
type: boolean
5656
schedule:
57-
- cron: "0 6,18 * * *" # Runs at 6:00 AM and 6:00 PM GMT
58-
59-
60-
57+
- cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
6158
env:
6259
GPT_MIN_CAPACITY: 150
6360
TEXT_EMBEDDING_MIN_CAPACITY: 80
@@ -139,8 +136,6 @@ jobs:
139136
fi
140137
fi
141138
142-
echo "✅ EXP configuration is valid"
143-
144139
- name: Checkout Code
145140
uses: actions/checkout@v4
146141

@@ -321,12 +316,6 @@ jobs:
321316
echo "Image tag: ${{ env.IMAGE_TAG }}"
322317
echo "Run number: ${{ github.run_number }}"
323318
324-
- name: Verify Docker Image Selection
325-
if: env.BUILD_DOCKER_IMAGE == 'false'
326-
run: |
327-
echo "✅ Using existing Docker image: latest_waf"
328-
echo "Image tag: ${{ env.IMAGE_TAG }}"
329-
330319
- name: Generate Unique Environment Name
331320
id: generate_env_name
332321
run: |
@@ -361,7 +350,7 @@ jobs:
361350
echo "Full Image: ${{ secrets.ACR_TEST_LOGIN_SERVER }}/webapp:${{ env.IMAGE_TAG }}"
362351
echo "================================"
363352
364-
- name: Deploy using azd up and extract values (${{ env.WAF_ENABLED == 'true' && 'WAF' || 'Non-WAF' }}+${{ env.EXP == 'true' && 'EXP' || 'Non-EXP' }})
353+
- name: Deploy using azd up and extract values (${{ github.event.inputs.waf_enabled == 'true' && 'WAF' || 'Non-WAF' }}+${{ (github.event.inputs.EXP == 'true' || github.event.inputs.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID != '' || github.event.inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID != '') && 'EXP' || 'Non-EXP' }})
365354
id: get_output
366355
run: |
367356
set -e
@@ -507,17 +496,20 @@ jobs:
507496
echo "Logged out from Azure."
508497
509498
e2e-test:
510-
# Run e2e tests for automatic triggers, when manually enabled, or when existing webapp URL is provided
511-
if: always() && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null || github.event.inputs.existing_webapp_url != '')
499+
# Run e2e tests only when deploy succeeds or when using existing webapp URL
500+
# Skip if deploy job failed (for both automatic and manual triggers)
501+
# Respect the run_e2e_tests checkbox - skip if explicitly unchecked
502+
if: (needs.deploy.result == 'success' || github.event.inputs.existing_webapp_url != '') && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null)
512503
needs: [deploy]
513504
uses: ./.github/workflows/test-automation.yml
514505
with:
515506
DOCGEN_URL: ${{ github.event.inputs.existing_webapp_url || needs.deploy.outputs.WEBAPP_URL }}
516507
secrets: inherit
517508

518509
cleanup-deployment:
519-
# Cleanup for automatic triggers or when manually enabled (skip cleanup when using existing webapp URL)
520-
if: always() && needs.deploy.result != 'skipped' && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && (github.event_name != 'workflow_dispatch' || (github.event.inputs.cleanup_resources == 'true' && github.event.inputs.existing_webapp_url == ''))
510+
# Cleanup when deploy succeeded and cleanup is not explicitly disabled
511+
# Skip if webapp URL is provided (no resources to cleanup) or cleanup checkbox is unchecked
512+
if: needs.deploy.result == 'success' && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && github.event.inputs.existing_webapp_url == '' && (github.event_name != 'workflow_dispatch' || github.event.inputs.cleanup_resources == 'true' || github.event.inputs.cleanup_resources == null)
521513
needs: [deploy]
522514
runs-on: ubuntu-latest
523515
env:
@@ -549,6 +541,7 @@ jobs:
549541
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
550542
551543
- name: Delete Docker Images from ACR
544+
if: github.event.inputs.existing_webapp_url == ''
552545
run: |
553546
set -e
554547
echo "🗑️ Cleaning up Docker images from Azure Container Registry..."

0 commit comments

Comments
 (0)