Skip to content

Commit 8bd1483

Browse files
feat: Optimized Deployment workflow by separating jobs into individual workflows
1 parent 2722e74 commit 8bd1483

File tree

10 files changed

+1757
-893
lines changed

10 files changed

+1757
-893
lines changed

.github/workflows/deploy-linux.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Deploy-Test-Cleanup (v2) Linux
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
inputs:
8+
azure_location:
9+
description: 'Azure Location For Deployment'
10+
required: false
11+
default: 'australiaeast'
12+
type: choice
13+
options:
14+
- 'australiaeast'
15+
- 'centralus'
16+
- 'eastasia'
17+
- 'eastus2'
18+
- 'japaneast'
19+
- 'northeurope'
20+
- 'southeastasia'
21+
- 'uksouth'
22+
resource_group_name:
23+
description: 'Resource Group Name (Optional)'
24+
required: false
25+
default: ''
26+
type: string
27+
28+
waf_enabled:
29+
description: 'Enable WAF'
30+
required: false
31+
default: false
32+
type: boolean
33+
EXP:
34+
description: 'Enable EXP'
35+
required: false
36+
default: false
37+
type: boolean
38+
build_docker_image:
39+
description: 'Build And Push Docker Image (Optional)'
40+
required: false
41+
default: false
42+
type: boolean
43+
44+
cleanup_resources:
45+
description: 'Cleanup Deployed Resources'
46+
required: false
47+
default: false
48+
type: boolean
49+
50+
run_e2e_tests:
51+
description: 'Run End-to-End Tests'
52+
required: false
53+
default: 'GoldenPath-Testing'
54+
type: choice
55+
options:
56+
- 'GoldenPath-Testing'
57+
- 'Smoke-Testing'
58+
- 'None'
59+
60+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID:
61+
description: 'Log Analytics Workspace ID (Optional)'
62+
required: false
63+
default: ''
64+
type: string
65+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID:
66+
description: 'AI Project Resource ID (Optional)'
67+
required: false
68+
default: ''
69+
type: string
70+
existing_webapp_url:
71+
description: 'Existing Container WebApp URL (Skips Deployment)'
72+
required: false
73+
default: ''
74+
type: string
75+
76+
schedule:
77+
- cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
78+
79+
jobs:
80+
Run:
81+
uses: ./.github/workflows/deploy-orchestrator.yml
82+
with:
83+
runner_os: ubuntu-latest
84+
azure_location: ${{ github.event.inputs.azure_location || 'australiaeast' }}
85+
resource_group_name: ${{ github.event.inputs.resource_group_name || '' }}
86+
waf_enabled: ${{ github.event.inputs.waf_enabled == 'true' }}
87+
EXP: ${{ github.event.inputs.EXP == 'true' }}
88+
build_docker_image: ${{ github.event.inputs.build_docker_image == 'true' }}
89+
cleanup_resources: ${{ github.event.inputs.cleanup_resources == 'true' }}
90+
run_e2e_tests: ${{ github.event.inputs.run_e2e_tests || 'GoldenPath-Testing' }}
91+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: ${{ github.event.inputs.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID || '' }}
92+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID: ${{ github.event.inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID || '' }}
93+
existing_webapp_url: ${{ github.event.inputs.existing_webapp_url || '' }}
94+
trigger_type: ${{ github.event_name }}
95+
secrets: inherit
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Deployment orchestrator v2
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner_os:
7+
description: 'Runner OS (ubuntu-latest or windows-latest)'
8+
required: true
9+
type: string
10+
azure_location:
11+
description: 'Azure Location For Deployment'
12+
required: false
13+
default: 'australiaeast'
14+
type: string
15+
resource_group_name:
16+
description: 'Resource Group Name (Optional)'
17+
required: false
18+
default: ''
19+
type: string
20+
waf_enabled:
21+
description: 'Enable WAF'
22+
required: false
23+
default: false
24+
type: boolean
25+
EXP:
26+
description: 'Enable EXP'
27+
required: false
28+
default: false
29+
type: boolean
30+
build_docker_image:
31+
description: 'Build And Push Docker Image (Optional)'
32+
required: false
33+
default: false
34+
type: boolean
35+
cleanup_resources:
36+
description: 'Cleanup Deployed Resources'
37+
required: false
38+
default: false
39+
type: boolean
40+
run_e2e_tests:
41+
description: 'Run End-to-End Tests'
42+
required: false
43+
default: 'GoldenPath-Testing'
44+
type: string
45+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID:
46+
description: 'Log Analytics Workspace ID (Optional)'
47+
required: false
48+
default: ''
49+
type: string
50+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID:
51+
description: 'AI Project Resource ID (Optional)'
52+
required: false
53+
default: ''
54+
type: string
55+
existing_webapp_url:
56+
description: 'Existing Container WebApp URL (Skips Deployment)'
57+
required: false
58+
default: ''
59+
type: string
60+
trigger_type:
61+
description: 'Trigger type (workflow_dispatch, pull_request, schedule)'
62+
required: true
63+
type: string
64+
secrets:
65+
AZURE_CLIENT_ID:
66+
required: true
67+
AZURE_CLIENT_SECRET:
68+
required: true
69+
AZURE_TENANT_ID:
70+
required: true
71+
AZURE_SUBSCRIPTION_ID:
72+
required: true
73+
ACR_TEST_LOGIN_SERVER:
74+
required: true
75+
ACR_TEST_USERNAME:
76+
required: true
77+
ACR_TEST_PASSWORD:
78+
required: true
79+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID:
80+
required: false
81+
AZURE_ENV_FOUNDRY_PROJECT_ID:
82+
required: false
83+
EMAILNOTIFICATION_LOGICAPP_URL_TA:
84+
required: false
85+
outputs:
86+
CONTAINER_WEB_APPURL:
87+
description: "Container Web App URL"
88+
value: ${{ jobs.deploy.outputs.CONTAINER_WEB_APPURL }}
89+
RESOURCE_GROUP_NAME:
90+
description: "Resource Group Name"
91+
value: ${{ jobs.deploy.outputs.RESOURCE_GROUP_NAME }}
92+
93+
env:
94+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
95+
96+
jobs:
97+
docker-build:
98+
uses: ./.github/workflows/job-docker-build.yml
99+
with:
100+
trigger_type: ${{ inputs.trigger_type }}
101+
build_docker_image: ${{ inputs.build_docker_image }}
102+
secrets:
103+
ACR_TEST_LOGIN_SERVER: ${{ secrets.ACR_TEST_LOGIN_SERVER }}
104+
ACR_TEST_USERNAME: ${{ secrets.ACR_TEST_USERNAME }}
105+
ACR_TEST_PASSWORD: ${{ secrets.ACR_TEST_PASSWORD }}
106+
107+
deploy:
108+
if: always() && (inputs.trigger_type != 'workflow_dispatch' || inputs.existing_webapp_url == '' || inputs.existing_webapp_url == null)
109+
needs: docker-build
110+
uses: ./.github/workflows/job-deploy.yml
111+
with:
112+
trigger_type: ${{ inputs.trigger_type }}
113+
runner_os: ${{ inputs.runner_os }}
114+
azure_location: ${{ inputs.azure_location }}
115+
resource_group_name: ${{ inputs.resource_group_name }}
116+
waf_enabled: ${{ inputs.waf_enabled }}
117+
EXP: ${{ inputs.EXP }}
118+
build_docker_image: ${{ inputs.build_docker_image }}
119+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
120+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: ${{ inputs.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID }}
121+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID: ${{ inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID }}
122+
docker_image_tag: ${{ needs.docker-build.outputs.IMAGE_TAG }}
123+
secrets:
124+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
125+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
126+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
127+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
128+
ACR_TEST_LOGIN_SERVER: ${{ secrets.ACR_TEST_LOGIN_SERVER }}
129+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID }}
130+
AZURE_ENV_FOUNDRY_PROJECT_ID: ${{ secrets.AZURE_ENV_FOUNDRY_PROJECT_ID }}
131+
132+
e2e-test:
133+
if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.CONTAINER_WEB_APPURL != '') || (inputs.existing_webapp_url != '' && inputs.existing_webapp_url != null)) && (inputs.trigger_type != 'workflow_dispatch' || (inputs.run_e2e_tests != 'None' && inputs.run_e2e_tests != '' && inputs.run_e2e_tests != null))
134+
needs: [docker-build, deploy]
135+
uses: ./.github/workflows/test-automation-v2.yml
136+
with:
137+
CP_WEB_URL: ${{ needs.deploy.outputs.CONTAINER_WEB_APPURL || inputs.existing_webapp_url }}
138+
TEST_SUITE: ${{ inputs.trigger_type == 'workflow_dispatch' && inputs.run_e2e_tests || 'GoldenPath-Testing' }}
139+
secrets: inherit
140+
141+
send-notification:
142+
if: always()
143+
needs: [docker-build, deploy, e2e-test]
144+
uses: ./.github/workflows/job-send-notification.yml
145+
with:
146+
trigger_type: ${{ inputs.trigger_type }}
147+
waf_enabled: ${{ inputs.waf_enabled }}
148+
EXP: ${{ inputs.EXP }}
149+
run_e2e_tests: ${{ inputs.run_e2e_tests }}
150+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
151+
deploy_result: ${{ needs.deploy.result }}
152+
e2e_test_result: ${{ needs.e2e-test.result }}
153+
CONTAINER_WEB_APPURL: ${{ needs.deploy.outputs.CONTAINER_WEB_APPURL }}
154+
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
155+
QUOTA_FAILED: ${{ needs.deploy.outputs.QUOTA_FAILED }}
156+
TEST_SUCCESS: ${{ needs.e2e-test.outputs.TEST_SUCCESS }}
157+
TEST_REPORT_URL: ${{ needs.e2e-test.outputs.TEST_REPORT_URL }}
158+
secrets:
159+
EMAILNOTIFICATION_LOGICAPP_URL_TA: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
160+
161+
cleanup-deployment:
162+
if: always() && needs.deploy.result == 'success' && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && inputs.existing_webapp_url == '' && (inputs.trigger_type != 'workflow_dispatch' || inputs.cleanup_resources == true || inputs.cleanup_resources == null)
163+
needs: [docker-build, deploy, e2e-test]
164+
uses: ./.github/workflows/job-cleanup-deployment.yml
165+
with:
166+
runner_os: ${{ inputs.runner_os }}
167+
trigger_type: ${{ inputs.trigger_type }}
168+
cleanup_resources: ${{ inputs.cleanup_resources }}
169+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
170+
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
171+
AZURE_LOCATION: ${{ needs.deploy.outputs.AZURE_LOCATION }}
172+
AZURE_ENV_OPENAI_LOCATION: ${{ needs.deploy.outputs.AZURE_ENV_OPENAI_LOCATION }}
173+
ENV_NAME: ${{ needs.deploy.outputs.ENV_NAME }}
174+
IMAGE_TAG: ${{ needs.deploy.outputs.IMAGE_TAG }}
175+
secrets:
176+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
177+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
178+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
179+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

0 commit comments

Comments
 (0)