Skip to content

Commit 2b28e45

Browse files
Prajwal-MicrosoftPavan-MicrosoftRoopan-MicrosoftAjitPadhi-Microsoftross-p-smith
authored
fix: Pipeline issue for deploy & build (#1919)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Roopan-Microsoft <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Roopan P M <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <[email protected]> Co-authored-by: Prashant-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Avijit-Microsoft <[email protected]> Co-authored-by: RaviKiran-Microsoft <[email protected]> Co-authored-by: Somesh Joshi <[email protected]> Co-authored-by: Himanshi Agrawal <[email protected]> Co-authored-by: pradeepjha-microsoft <[email protected]> Co-authored-by: Harmanpreet Kaur <[email protected]> Co-authored-by: Bangarraju-Microsoft <[email protected]> Co-authored-by: Harsh-Microsoft <[email protected]> Co-authored-by: Kanchan-Microsoft <[email protected]> Co-authored-by: Cristopher Coronado <[email protected]> Co-authored-by: Cristopher Coronado Moreira <[email protected]> Co-authored-by: Vamshi-Microsoft <[email protected]> Co-authored-by: Thanusree-Microsoft <[email protected]> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]>
1 parent 4925b3b commit 2b28e45

File tree

5 files changed

+72
-24
lines changed

5 files changed

+72
-24
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/devcontainers/python:3.11
1+
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm
22

33
# install git
44
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

.github/workflows/ci.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ jobs:
3636
- name: Checkout code
3737
uses: actions/checkout@v4
3838

39+
- name: Install AZD
40+
run: |
41+
set -e
42+
echo "Fetching deployment output..."
43+
# Install azd (Azure Developer CLI) - required by process_sample_data.sh
44+
curl -fsSL https://aka.ms/install-azd.sh | bash
45+
3946
- name: Run Quota Check
4047
id: quota-check
4148
run: |
@@ -79,6 +86,45 @@ jobs:
7986
echo "Selected Region: $VALID_REGION"
8087
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
8188
89+
- name: Generate Resource Group Name
90+
id: generate_rg_name
91+
run: |
92+
echo "Generating a unique resource group name..."
93+
ACCL_NAME="ca" # Account name as specified
94+
SHORT_UUID=$(uuidgen | cut -d'-' -f1)
95+
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
96+
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
97+
echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
98+
99+
- name: Check and Create Resource Group
100+
id: check_create_rg
101+
run: |
102+
echo "RESOURCE_GROUP: ${{ env.RESOURCE_GROUP_NAME }}"
103+
set -e
104+
echo "Checking if resource group exists..."
105+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
106+
if [ "$rg_exists" = "false" ]; then
107+
echo "Resource group does not exist. Creating..."
108+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location ${{ env.AZURE_LOCATION }} --tags SecurityControl=Ignore || { echo "Error creating resource group"; exit 1; }
109+
else
110+
echo "Resource group already exists."
111+
fi
112+
# Set output for other jobs
113+
echo "RESOURCE_GROUP_NAME=${{ env.RESOURCE_GROUP_NAME }}" >> $GITHUB_OUTPUT
114+
115+
116+
- name: Generate Unique Solution Prefix
117+
id: generate_solution_prefix
118+
run: |
119+
set -e
120+
COMMON_PART="pslc"
121+
TIMESTAMP=$(date +%s)
122+
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 3)
123+
UNIQUE_SOLUTION_SUFFIX="${COMMON_PART}${UPDATED_TIMESTAMP}"
124+
echo "SOLUTION_SUFFIX=${UNIQUE_SOLUTION_SUFFIX}" >> $GITHUB_ENV
125+
echo "SOLUTION_SUFFIX=${UNIQUE_SOLUTION_SUFFIX}" >> $GITHUB_OUTPUT
126+
echo "Generated SOLUTION_SUFFIX: ${UNIQUE_SOLUTION_SUFFIX}"
127+
82128
- name: Login to GitHub Container Registry
83129
uses: docker/login-action@v3
84130
with:
@@ -103,8 +149,9 @@ jobs:
103149
- name: Pre-build image and deploy
104150
uses: devcontainers/[email protected]
105151
env:
106-
AZURE_ENV_NAME: ${{ github.run_id }}
152+
AZURE_ENV_NAME: ${{ env.SOLUTION_SUFFIX }}
107153
AZURE_LOCATION: ${{ env.AZURE_LOCATION }}
154+
AZURE_RESOURCE_GROUP: ${{ env.RESOURCE_GROUP_NAME }}
108155
with:
109156
push: never
110157
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
@@ -141,6 +188,7 @@ jobs:
141188
AZURE_SUBSCRIPTION_ID
142189
AZURE_ENV_NAME
143190
AZURE_LOCATION
191+
AZURE_RESOURCE_GROUP
144192
AUTH_ENABLED=false
145193
AZURE_USE_AUTHENTICATION=false
146194
AZURE_ENABLE_AUTH=false

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ azd-login: ## 🔑 Login to Azure with azd and a SPN
6565
# Fixed Makefile section for deploy target
6666
deploy: azd-login ## Deploy everything to Azure
6767
@echo -e "\e[34m$@\e[0m" || true
68-
@azd env new ${AZURE_ENV_NAME}
68+
@echo "AZURE_ENV_NAME: '${AZURE_ENV_NAME}'"
69+
@echo "AZURE_LOCATION: '${AZURE_LOCATION}'"
70+
@echo "AZURE_RESOURCE_GROUP: '${AZURE_RESOURCE_GROUP}'"
71+
72+
# Validate required variables
73+
@if [ -z "${AZURE_ENV_NAME}" ]; then echo "❌ AZURE_ENV_NAME not set"; exit 1; fi
74+
@if [ -z "${AZURE_LOCATION}" ]; then echo "❌ AZURE_LOCATION not set"; exit 1; fi
75+
@if [ -z "${AZURE_RESOURCE_GROUP}" ]; then echo "❌ AZURE_RESOURCE_GROUP not set"; exit 1; fi
76+
77+
@azd env new ${AZURE_ENV_NAME} --location ${AZURE_LOCATION}
78+
@azd env set AZURE_RESOURCE_GROUP ${AZURE_RESOURCE_GROUP}
6979

7080
# Provision and deploy
7181
@azd provision --no-prompt

infra/main.bicep

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ module keyvault './modules/key-vault/vault/vault.bicep' = {
768768
? [
769769
{
770770
principalId: principalId
771-
principalType: 'User'
772771
roleDefinitionIdOrName: 'Key Vault Secrets User'
773772
}
774773
]
@@ -874,12 +873,10 @@ module openai 'modules/core/ai/cognitiveservices.bicep' = {
874873
{
875874
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
876875
principalId: principalId
877-
principalType: 'User'
878876
}
879877
{
880878
roleDefinitionIdOrName: '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' // Cognitive Services Contributor
881879
principalId: principalId
882-
principalType: 'User'
883880
}
884881
]
885882
: []
@@ -921,7 +918,6 @@ module computerVision 'modules/core/ai/cognitiveservices.bicep' = if (useAdvance
921918
{
922919
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
923920
principalId: principalId
924-
principalType: 'User'
925921
}
926922
]
927923
: []
@@ -966,7 +962,6 @@ module speechService 'modules/core/ai/cognitiveservices.bicep' = {
966962
{
967963
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
968964
principalId: principalId
969-
principalType: 'User'
970965
}
971966
]
972967
: []
@@ -1048,17 +1043,14 @@ module search 'br/public:avm/res/search/search-service:0.11.1' = if (databaseTyp
10481043
{
10491044
roleDefinitionIdOrName: '8ebe5a00-799e-43f5-93ac-243d3dce84a7' // Search Index Data Contributor
10501045
principalId: principalId
1051-
principalType: 'User'
10521046
}
10531047
{
10541048
roleDefinitionIdOrName: '7ca78c08-252a-4471-8644-bb5ff32d4ba0' // Search Service Contributor
10551049
principalId: principalId
1056-
principalType: 'User'
10571050
}
10581051
{
10591052
roleDefinitionIdOrName: '1407120a-92aa-4202-b7e9-c0e197c71c8f' // Search Index Data Reader
10601053
principalId: principalId
1061-
principalType: 'User'
10621054
}
10631055
]
10641056
: []
@@ -1441,7 +1433,6 @@ module formrecognizer 'modules/core/ai/cognitiveservices.bicep' = {
14411433
{
14421434
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
14431435
principalId: principalId
1444-
principalType: 'User'
14451436
}
14461437
]
14471438
: []
@@ -1482,7 +1473,6 @@ module contentsafety 'modules/core/ai/cognitiveservices.bicep' = {
14821473
{
14831474
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
14841475
principalId: principalId
1485-
principalType: 'User'
14861476
}
14871477
]
14881478
: []

0 commit comments

Comments
 (0)