Skip to content

Commit cadee94

Browse files
Merge pull request #7 from Vamshi-Microsoft/vk-dockerbuild-job
feat: Enhance deployment parameters by adding azureAiServiceLocation
2 parents 1499db1 + 673b14d commit cadee94

3 files changed

Lines changed: 50 additions & 42 deletions

File tree

.github/workflows/deploy-Parameterized.yml

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,19 @@ env:
7070
jobs:
7171
docker-build:
7272
# ============================================================================
73-
# DOCKER BUILD JOB - When does it run?
73+
# DOCKER BUILD JOB SCENARIOS
7474
# ============================================================================
75-
# ✅ RUNS ONLY WHEN:
76-
# - Trigger = Manual (workflow_dispatch)
77-
# AND "Build and push Docker image" checkbox = ✅ CHECKED
75+
# Condition: Manual trigger + "Build Docker image" checkbox checked
7876
#
79-
# ❌ SKIPPED WHEN:
80-
# - Any automatic trigger (Pull Request, Schedule, Workflow Run)
81-
# - Manual trigger but "Build and push Docker image" = ❌ UNCHECKED
82-
# - Manual trigger but checkbox not provided (defaults to false)
77+
# | Trigger Type | Build Checkbox | Result | Image Used |
78+
# |-----------------|----------------|----------|-----------------------|
79+
# | Pull Request | N/A | ❌ SKIP | Branch image |
80+
# | Schedule | N/A | ❌ SKIP | latest_waf |
81+
# | Workflow Run | N/A | ❌ SKIP | Branch image |
82+
# | Manual | ✅ Checked | ✅ RUN | Custom unique tag |
83+
# | Manual | ❌ Unchecked | ❌ SKIP | Branch image |
8384
#
84-
# SIMPLE RULE: Only builds Docker when you manually trigger AND check the box!
85+
# Output: IMAGE_TAG (if runs) → Used by deploy job for custom deployments
8586
# ============================================================================
8687
if: github.event_name == 'workflow_dispatch' && github.event.inputs.build_docker_image == 'true'
8788
runs-on: ubuntu-latest
@@ -135,18 +136,19 @@ jobs:
135136
136137
deploy:
137138
# ============================================================================
138-
# DEPLOY JOB - When does it run?
139+
# DEPLOY JOB SCENARIOS
139140
# ============================================================================
140-
# ✅ RUNS WHEN:
141-
# - ANY automatic trigger (Pull Request, Schedule, Workflow Run) = ALWAYS RUNS
142-
# - Manual trigger with "Existing WebApp URL" = EMPTY/BLANK
143-
# - Manual trigger with "Existing WebApp URL" = NOT PROVIDED
141+
# Condition: Auto trigger OR Manual with no existing webapp URL
144142
#
145-
# ❌ SKIPPED WHEN:
146-
# - Manual trigger with "Existing WebApp URL" = PROVIDED/FILLED
147-
# (Why skip? Because you want to test existing app, not deploy new one!)
143+
# | Trigger Type | Existing URL | Result | Purpose |
144+
# |-----------------|-----------------|----------|------------------------|
145+
# | Pull Request | N/A | ✅ RUN | Test PR changes |
146+
# | Schedule | N/A | ✅ RUN | Regular validation |
147+
# | Workflow Run | N/A | ✅ RUN | Deploy after build |
148+
# | Manual | Empty/None | ✅ RUN | Fresh deployment |
149+
# | Manual | Provided URL | ❌ SKIP | Test existing only |
148150
#
149-
# SIMPLE RULE: Deploys new infrastructure unless you provide existing webapp URL!
151+
# Dependencies: Waits for docker-build (uses always() if build skips)
150152
# ============================================================================
151153
if: always() && (github.event_name != 'workflow_dispatch' || github.event.inputs.existing_webapp_url == '' || github.event.inputs.existing_webapp_url == null)
152154
needs: [docker-build]
@@ -555,44 +557,44 @@ jobs:
555557
556558
e2e-test:
557559
# ============================================================================
558-
# E2E TEST JOB - When does it run?
560+
# E2E TEST JOB SCENARIOS
559561
# ============================================================================
560-
# ✅ RUNS WHEN:
561-
# - Deploy job succeeded AND "Run end-to-end tests" = ✅ CHECKED (default)
562-
# - Manual trigger with "Existing WebApp URL" provided AND tests = ✅ CHECKED
563-
# - Any automatic trigger (tests always run by default if deploy succeeds)
562+
# Condition: Webapp available (deployed OR existing) AND tests enabled
564563
#
565-
# ❌ SKIPPED WHEN:
566-
# - Deploy job failed or was skipped
567-
# - Manual trigger with "Run end-to-end tests" = ❌ UNCHECKED
568-
# - No webapp available (neither deployed nor existing URL provided)
564+
# | Deploy Result | Existing URL | Test Checkbox | Result | Test Target |
565+
# |---------------|--------------|--------------- |----------|----------------|
566+
# | Success | N/A | Auto/✅/Default | ✅ RUN | Deployed URL |
567+
# | Success | Provided | Auto/✅/Default | ✅ RUN | Existing URL |
568+
# | Failed | Provided | Auto/✅/Default | ✅ RUN | Existing URL |
569+
# | Failed | N/A | Any | ❌ SKIP | No URL |
570+
# | Success | N/A | ❌ Unchecked | ❌ SKIP | Tests disabled |
571+
# | Success | Provided | ❌ Unchecked | ❌ SKIP | Tests disabled |
569572
#
570-
# SIMPLE RULE: Tests run against any available webapp unless you uncheck the box!
573+
# URL Priority: existing_webapp_url || deployed WEBAPP_URL
571574
# ============================================================================
572-
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)
573-
needs: [deploy]
575+
if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.WEBAPP_URL != '') || (github.event.inputs.existing_webapp_url != '' && github.event.inputs.existing_webapp_url != null)) && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null)
576+
needs: [docker-build, deploy]
574577
uses: ./.github/workflows/test-automation.yml
575578
with:
576579
DOCGEN_URL: ${{ github.event.inputs.existing_webapp_url || needs.deploy.outputs.WEBAPP_URL }}
577580
secrets: inherit
578581

579582
cleanup-deployment:
580583
# ============================================================================
581-
# CLEANUP JOB - When does it run?
584+
# CLEANUP JOB SCENARIOS
582585
# ============================================================================
583-
# ✅ RUNS WHEN:
584-
# - Deploy job succeeded (created new resources to clean up)
585-
# - Resource group was created (has RESOURCE_GROUP_NAME output)
586-
# - "Existing WebApp URL" = EMPTY (means we deployed new stuff to clean)
587-
# - "Cleanup deployed resources" = ✅ CHECKED (default) OR not manual trigger
586+
# Condition: Deploy succeeded + Resource group created + No existing URL + Cleanup enabled
588587
#
589-
# ❌ SKIPPED WHEN:
590-
# - Deploy job failed (nothing to clean up)
591-
# - "Existing WebApp URL" provided (didn't deploy new resources)
592-
# - Manual trigger with "Cleanup deployed resources" = ❌ UNCHECKED
593-
# - No resource group name available (deployment didn't create resources)
588+
# | Deploy Result | Resource Group | Existing URL | Cleanup Checkbox | Result | Actions |
589+
# |---------------|----------------|--------------|------------------|----------|------------------|
590+
# | Success | Created | N/A | Auto/✅/Default | ✅ RUN | Delete RG + ACR |
591+
# | Success | Created | N/A | ❌ Unchecked | ❌ SKIP | Keep resources |
592+
# | Success | Created | Provided | Any | ❌ SKIP | No new resources |
593+
# | Failed | N/A | Any | Any | ❌ SKIP | Nothing to clean |
594+
# | Success | None | Any | Any | ❌ SKIP | No resources |
594595
#
595-
# SIMPLE RULE: Cleans up newly deployed resources unless you uncheck the box!
596+
# Actions: Deletes resource group + custom Docker images (preserves standard tags)
597+
# Dependencies: Waits for all jobs (docker-build, deploy, e2e-test)
596598
# ============================================================================
597599
if: always() && 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)
598600
needs: [docker-build, deploy, e2e-test]

infra/main.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
},
4444
"acrName": {
4545
"value": "${AZURE_ENV_ACR_NAME}"
46+
},
47+
"azureAiServiceLocation": {
48+
"value": "${AZURE_ENV_OPENAI_LOCATION}"
4649
}
4750
}
4851
}

infra/main.waf.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
},
6262
"acrName": {
6363
"value": "${AZURE_ENV_ACR_NAME}"
64+
},
65+
"azureAiServiceLocation": {
66+
"value": "${AZURE_ENV_OPENAI_LOCATION}"
6467
}
6568
}
6669
}

0 commit comments

Comments
 (0)