11name : DocGen Deploy-Test-Cleanup Pipeline
22
33on :
4- workflow_run :
5- workflows : ["Build Docker and Optional Push"]
6- types :
7- - completed
8- branches :
9- - main
10- - dev
11- - demo
12-
13- schedule :
14- - cron : ' 0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
4+ pull_request :
5+ branches :
6+ - main
7+ workflow_run :
8+ workflows : ["Build Docker and Optional Push"]
9+ types :
10+ - completed
11+ branches :
12+ - main
13+ - dev
14+ - demo
15+
16+ schedule :
17+ - cron : ' 0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
1518
1619env :
17- GPT_MIN_CAPACITY : 250
18- TEXT_EMBEDDING_MIN_CAPACITY : 40
19- BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
20+ GPT_MIN_CAPACITY : 150
21+ TEXT_EMBEDDING_MIN_CAPACITY : 80
22+ BRANCH_NAME : ${{ github.event.workflow_run.head_branch || github. head_ref || github.ref_name }}
2023
2124jobs :
2225 deploy :
2629 WEBAPP_URL : ${{ steps.get_output.outputs.WEBAPP_URL }}
2730 steps :
2831 - name : Checkout Code
29- uses : actions/checkout@v3
32+ uses : actions/checkout@v5
3033
3134 - name : Setup Azure CLI
3235 run : |
8386 - name : Set Deployment Region
8487 run : |
8588 echo "Selected Region: $VALID_REGION"
89+ echo "AZURE_AI_LOCATION=$VALID_REGION" >> $GITHUB_ENV
8690 echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
91+ if [ "$VALID_REGION" == "eastus" ] || [ "$VALID_REGION" == "westus3" ]; then
92+ echo "AZURE_LOCATION=uksouth" >> $GITHUB_ENV
93+ fi
8794
8895 - name : Generate Resource Group Name
8996 id : generate_rg_name
@@ -126,29 +133,32 @@ jobs:
126133 set -e
127134 # set image tag based on branch
128135 if [[ "${{ env.BRANCH_NAME }}" == "main" ]]; then
129- IMAGE_TAG="latest "
136+ IMAGE_TAG="latest_waf "
130137 elif [[ "${{ env.BRANCH_NAME }}" == "dev" ]]; then
131138 IMAGE_TAG="dev"
132139 elif [[ "${{ env.BRANCH_NAME }}" == "demo" ]]; then
133140 IMAGE_TAG="demo"
134141 else
135- IMAGE_TAG="latest "
142+ IMAGE_TAG="latest_waf "
136143 fi
137144
145+ # Generate current timestamp in desired format: YYYY-MM-DDTHH:MM:SS.SSSSSSSZ
146+ current_date=$(date -u +"%Y-%m-%dT%H:%M:%S.%7NZ")
147+
138148 az deployment group create \
139149 --name ${{ env.SOLUTION_PREFIX }}-deployment \
140150 --resource-group ${{ env.RESOURCE_GROUP_NAME }} \
141- --template-file infra/main.json \
151+ --template-file infra/main.bicep \
142152 --parameters \
143- environmentName="${{ env.SOLUTION_PREFIX }}" \
144- secondaryLocation="northcentralus" \
145- deploymentType="GlobalStandard" \
146- gptModelName="gpt-4.1" \
147- azureOpenaiAPIVersion="2024-05-01-preview" \
148- gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} \
149- embeddingModel="text-embedding-ada-002" \
153+ solutionName="${{ env.SOLUTION_PREFIX }}" \
154+ secondaryLocation="${{ env.AZURE_LOCATION }}" \
155+ location="${{ env.AZURE_LOCATION }}" \
156+ gptModelCapacity=${{ env.GPT_MIN_CAPACITY }} \
150157 embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} \
151- imageTag="${IMAGE_TAG}"
158+ azureAiServiceLocation=${{ env.AZURE_AI_LOCATION }} \
159+ imageTag="${IMAGE_TAG}"\
160+ createdBy="Pipeline" \
161+ tags="{'SecurityControl':'Ignore','Purpose':'Deploying and Cleaning Up Resources for Validation','CreatedDate':'$current_date'}"
152162
153163 - name : Get Deployment Output and extract Values
154164 id : get_output
@@ -167,22 +177,31 @@ jobs:
167177 echo "KEY_VAULT_NAME=$KEY_VAULT_NAME" >> $GITHUB_ENV
168178 COSMOSDB_ACCOUNT_NAME=$(echo $BICEP_OUTPUT | jq -r '.cosmosdB_ACCOUNT_NAME.value')
169179 echo "COSMOSDB_ACCOUNT_NAME=$COSMOSDB_ACCOUNT_NAME" >> $GITHUB_ENV
180+ AI_FOUNDRY_RESOURCE_ID=$(echo $BICEP_OUTPUT | jq -r '.aI_FOUNDRY_RESOURCE_ID.value')
181+ echo "AI_FOUNDRY_RESOURCE_ID=$AI_FOUNDRY_RESOURCE_ID" >> $GITHUB_ENV
182+ AI_SEARCH_SERVICE_NAME=$(echo $BICEP_OUTPUT | jq -r '.aI_SEARCH_SERVICE_NAME.value')
183+ echo "AI_SEARCH_SERVICE_NAME=$AI_SEARCH_SERVICE_NAME" >> $GITHUB_ENV
170184 echo "Deployment output: $BICEP_OUTPUT"
171185
172186 - name : Run Post-Deployment Script
173187 id : post_deploy
188+ env :
189+ AZURE_SUBSCRIPTION_ID : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
174190 run : |
175191 set -e
176192 az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
177193
178194 echo "Running post-deployment script..."
179- bash ./infra/scripts/copy_kb_files.sh \
195+
196+ bash ./infra/scripts/process_sample_data.sh \
180197 "${{ env.STORAGE_ACCOUNT_NAME }}" \
181198 "${{ env.STORAGE_CONTAINER_NAME }}" \
182- "${{ secrets.AZURE_CLIENT_ID }}"
183- bash ./infra/scripts/run_create_index_scripts.sh \
184199 "${{ env.KEY_VAULT_NAME }}" \
185- "${{ secrets.AZURE_CLIENT_ID }}"
200+ "${{ env.COSMOSDB_ACCOUNT_NAME }}" \
201+ "${{ env.RESOURCE_GROUP_NAME }}" \
202+ "${{ env.AI_SEARCH_SERVICE_NAME }}" \
203+ "${{ secrets.AZURE_CLIENT_ID }}" \
204+ "${{ env.AI_FOUNDRY_RESOURCE_ID }}"
186205
187206 - name : Logout from Azure
188207 if : always()
@@ -395,4 +414,4 @@ jobs:
395414 if : always()
396415 run : |
397416 az logout
398- echo "Logged out from Azure."
417+ echo "Logged out from Azure."
0 commit comments