Skip to content

Commit 38151c9

Browse files
pipelines creation initial version v1
1 parent 49fbd3f commit 38151c9

File tree

8 files changed

+1484
-0
lines changed

8 files changed

+1484
-0
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Deployment orchestrator
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+
65+
env:
66+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
67+
68+
jobs:
69+
docker-build:
70+
uses: ./.github/workflows/job-docker-build.yml
71+
with:
72+
trigger_type: ${{ inputs.trigger_type }}
73+
build_docker_image: ${{ inputs.build_docker_image }}
74+
secrets: inherit
75+
76+
deploy:
77+
if: always() && (inputs.trigger_type != 'workflow_dispatch' || inputs.existing_webapp_url == '' || inputs.existing_webapp_url == null)
78+
needs: docker-build
79+
uses: ./.github/workflows/job-deploy.yml
80+
with:
81+
trigger_type: ${{ inputs.trigger_type }}
82+
runner_os: ${{ inputs.runner_os }}
83+
azure_location: ${{ inputs.azure_location }}
84+
resource_group_name: ${{ inputs.resource_group_name }}
85+
waf_enabled: ${{ inputs.waf_enabled }}
86+
EXP: ${{ inputs.EXP }}
87+
build_docker_image: ${{ inputs.build_docker_image }}
88+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
89+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: ${{ inputs.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID }}
90+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID: ${{ inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID }}
91+
docker_image_tag: ${{ needs.docker-build.outputs.IMAGE_TAG }}
92+
run_e2e_tests: ${{ inputs.run_e2e_tests }}
93+
cleanup_resources: ${{ inputs.cleanup_resources }}
94+
secrets: inherit
95+
96+
e2e-test:
97+
if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.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))
98+
needs: [docker-build, deploy]
99+
uses: ./.github/workflows/test-automation-v2.yml
100+
with:
101+
DOCGEN_URL: ${{ needs.deploy.outputs.WEB_APPURL || inputs.existing_webapp_url }}
102+
TEST_SUITE: ${{ inputs.trigger_type == 'workflow_dispatch' && inputs.run_e2e_tests || 'GoldenPath-Testing' }}
103+
secrets: inherit
104+
105+
send-notification:
106+
if: always()
107+
needs: [docker-build, deploy, e2e-test]
108+
uses: ./.github/workflows/job-send-notification.yml
109+
with:
110+
trigger_type: ${{ inputs.trigger_type }}
111+
waf_enabled: ${{ inputs.waf_enabled }}
112+
EXP: ${{ inputs.EXP }}
113+
run_e2e_tests: ${{ inputs.run_e2e_tests }}
114+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
115+
deploy_result: ${{ needs.deploy.result }}
116+
e2e_test_result: ${{ needs.e2e-test.result }}
117+
WEB_APPURL: ${{ needs.deploy.outputs.WEB_APPURL || inputs.existing_webapp_url }}
118+
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
119+
QUOTA_FAILED: ${{ needs.deploy.outputs.QUOTA_FAILED }}
120+
TEST_SUCCESS: ${{ needs.e2e-test.outputs.TEST_SUCCESS }}
121+
TEST_REPORT_URL: ${{ needs.e2e-test.outputs.TEST_REPORT_URL }}
122+
secrets: inherit
123+
124+
cleanup-deployment:
125+
if: always() && needs.deploy.result == 'success' && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && inputs.existing_webapp_url == '' && (inputs.trigger_type != 'workflow_dispatch' || inputs.cleanup_resources)
126+
needs: [docker-build, deploy, e2e-test]
127+
uses: ./.github/workflows/job-cleanup-deployment.yml
128+
with:
129+
runner_os: ${{ inputs.runner_os }}
130+
trigger_type: ${{ inputs.trigger_type }}
131+
cleanup_resources: ${{ inputs.cleanup_resources }}
132+
existing_webapp_url: ${{ inputs.existing_webapp_url }}
133+
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
134+
AZURE_LOCATION: ${{ needs.deploy.outputs.AZURE_LOCATION }}
135+
AZURE_ENV_OPENAI_LOCATION: ${{ needs.deploy.outputs.AZURE_ENV_OPENAI_LOCATION }}
136+
ENV_NAME: ${{ needs.deploy.outputs.ENV_NAME }}
137+
IMAGE_TAG: ${{ needs.deploy.outputs.IMAGE_TAG }}
138+
secrets: inherit
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Deploy-Test-Cleanup (v2) Windows
2+
on:
3+
push:
4+
branches:
5+
- main # Adjust this to the branch you want to trigger the deployment on
6+
- dev
7+
- demo
8+
schedule:
9+
- cron: "0 10,22 * * *" # Runs at 10:00 AM and 10:00 PM GMT
10+
11+
workflow_dispatch:
12+
inputs:
13+
azure_location:
14+
description: 'Azure Location For Deployment'
15+
required: false
16+
default: 'australiaeast'
17+
type: choice
18+
options:
19+
- 'australiaeast'
20+
- 'centralus'
21+
- 'eastasia'
22+
- 'eastus2'
23+
- 'japaneast'
24+
- 'northeurope'
25+
- 'southeastasia'
26+
- 'uksouth'
27+
resource_group_name:
28+
description: 'Resource Group Name (Optional)'
29+
required: false
30+
default: ''
31+
type: string
32+
33+
waf_enabled:
34+
description: 'Enable WAF'
35+
required: false
36+
default: false
37+
type: boolean
38+
EXP:
39+
description: 'Enable EXP'
40+
required: false
41+
default: false
42+
type: boolean
43+
build_docker_image:
44+
description: 'Build And Push Docker Image (Optional)'
45+
required: false
46+
default: false
47+
type: boolean
48+
49+
cleanup_resources:
50+
description: 'Cleanup Deployed Resources'
51+
required: false
52+
default: false
53+
type: boolean
54+
55+
run_e2e_tests:
56+
description: 'Run End-to-End Tests'
57+
required: false
58+
default: 'GoldenPath-Testing'
59+
type: choice
60+
options:
61+
- 'GoldenPath-Testing'
62+
- 'Smoke-Testing'
63+
- 'None'
64+
65+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID:
66+
description: 'Log Analytics Workspace ID (Optional)'
67+
required: false
68+
default: ''
69+
type: string
70+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID:
71+
description: 'AI Project Resource ID (Optional)'
72+
required: false
73+
default: ''
74+
type: string
75+
existing_webapp_url:
76+
description: 'Existing WebApp URL (Skips Deployment)'
77+
required: false
78+
default: ''
79+
type: string
80+
81+
# schedule:
82+
# - cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
83+
84+
jobs:
85+
Run:
86+
uses: ./.github/workflows/deploy-orchestrator.yml
87+
with:
88+
runner_os: windows-latest
89+
azure_location: ${{ github.event.inputs.azure_location || 'australiaeast' }}
90+
resource_group_name: ${{ github.event.inputs.resource_group_name || '' }}
91+
waf_enabled: ${{ github.event.inputs.waf_enabled == 'true' }}
92+
EXP: ${{ github.event.inputs.EXP == 'true' }}
93+
build_docker_image: ${{ github.event.inputs.build_docker_image == 'true' }}
94+
cleanup_resources: ${{ github.event.inputs.cleanup_resources == 'true' }}
95+
run_e2e_tests: ${{ github.event.inputs.run_e2e_tests || 'GoldenPath-Testing' }}
96+
AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: ${{ github.event.inputs.AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID || '' }}
97+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID: ${{ github.event.inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID || '' }}
98+
existing_webapp_url: ${{ github.event.inputs.existing_webapp_url || '' }}
99+
trigger_type: ${{ github.event_name }}
100+
secrets: inherit
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Cleanup Deployment Job
2+
on:
3+
workflow_call:
4+
inputs:
5+
runner_os:
6+
description: 'Runner OS (ubuntu-latest or windows-latest)'
7+
required: true
8+
type: string
9+
trigger_type:
10+
description: 'Trigger type (workflow_dispatch, pull_request, schedule)'
11+
required: true
12+
type: string
13+
cleanup_resources:
14+
description: 'Cleanup Deployed Resources'
15+
required: false
16+
default: false
17+
type: boolean
18+
existing_webapp_url:
19+
description: 'Existing Container WebApp URL (Skips Deployment)'
20+
required: false
21+
default: ''
22+
type: string
23+
RESOURCE_GROUP_NAME:
24+
description: 'Resource Group Name to cleanup'
25+
required: true
26+
type: string
27+
AZURE_LOCATION:
28+
description: 'Azure Location'
29+
required: true
30+
type: string
31+
AZURE_ENV_OPENAI_LOCATION:
32+
description: 'Azure OpenAI Location'
33+
required: true
34+
type: string
35+
ENV_NAME:
36+
description: 'Environment Name'
37+
required: true
38+
type: string
39+
IMAGE_TAG:
40+
description: 'Docker Image Tag'
41+
required: true
42+
type: string
43+
44+
jobs:
45+
cleanup-deployment:
46+
runs-on: ${{ inputs.runner_os }}
47+
continue-on-error: true
48+
env:
49+
RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
50+
AZURE_LOCATION: ${{ inputs.AZURE_LOCATION }}
51+
AZURE_ENV_OPENAI_LOCATION: ${{ inputs.AZURE_ENV_OPENAI_LOCATION }}
52+
ENV_NAME: ${{ inputs.ENV_NAME }}
53+
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
54+
steps:
55+
- name: Setup Azure CLI
56+
shell: bash
57+
run: |
58+
if [[ "${{ runner.os }}" == "Linux" ]]; then
59+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
60+
fi
61+
az --version
62+
63+
- name: Login to Azure
64+
shell: bash
65+
run: |
66+
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
67+
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
68+
69+
- name: Delete Resource Group (Optimized Cleanup)
70+
id: delete_rg
71+
shell: bash
72+
run: |
73+
set -e
74+
echo "🗑️ Starting optimized resource cleanup..."
75+
echo "Deleting resource group: ${{ env.RESOURCE_GROUP_NAME }}"
76+
77+
az group delete \
78+
--name "${{ env.RESOURCE_GROUP_NAME }}" \
79+
--yes \
80+
--no-wait
81+
82+
echo "✅ Resource group deletion initiated (running asynchronously)"
83+
echo "Note: Resources will be cleaned up in the background"
84+
85+
- name: Logout from Azure
86+
if: always()
87+
shell: bash
88+
run: |
89+
azd auth logout || true
90+
az logout || echo "Warning: Failed to logout from Azure CLI"
91+
echo "Logged out from Azure."
92+
93+
- name: Generate Cleanup Job Summary
94+
if: always()
95+
shell: bash
96+
run: |
97+
echo "## 🧹 Cleanup Job Summary" >> $GITHUB_STEP_SUMMARY
98+
echo "" >> $GITHUB_STEP_SUMMARY
99+
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
100+
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
101+
echo "| **Resource Group deletion Status** | ${{ steps.delete_rg.outcome == 'success' && '✅ Initiated' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
102+
echo "| **Resource Group** | \`${{ env.RESOURCE_GROUP_NAME }}\` |" >> $GITHUB_STEP_SUMMARY
103+
echo "" >> $GITHUB_STEP_SUMMARY
104+
if [[ "${{ steps.delete_rg.outcome }}" == "success" ]]; then
105+
echo "### ✅ Cleanup Details" >> $GITHUB_STEP_SUMMARY
106+
echo "- Successfully initiated deletion for Resource Group \`${{ env.RESOURCE_GROUP_NAME }}\`" >> $GITHUB_STEP_SUMMARY
107+
echo "" >> $GITHUB_STEP_SUMMARY
108+
else
109+
echo "### ❌ Cleanup Failed" >> $GITHUB_STEP_SUMMARY
110+
echo "- Cleanup process encountered an error" >> $GITHUB_STEP_SUMMARY
111+
echo "- Manual cleanup may be required for:" >> $GITHUB_STEP_SUMMARY
112+
echo " - Resource Group: \`${{ env.RESOURCE_GROUP_NAME }}\`" >> $GITHUB_STEP_SUMMARY
113+
echo "- Check the cleanup-deployment job logs for detailed error information" >> $GITHUB_STEP_SUMMARY
114+
fi

0 commit comments

Comments
 (0)