Skip to content

Commit

Permalink
Gitub Actions のエラーを解消 (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
marumaru1019 authored Jan 19, 2024
1 parent ee2f53a commit 1d58f2b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/5.internal-document-search-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ jobs:

- name: what-if using Azure CLI
run: |
results=$(az deployment sub what-if --template-file "./5.internal-document-search/infra/main.bicep" --location JapanEast -p vmLoginPassword=dummy -p resourceGroupName=rg-${{ github.run_id }} -p isPrivateNetworkEnabled=false -p environmentName=${{ github.run_id }} -p location=japaneast)
set +e
results=$(az deployment sub what-if --template-file "./5.internal-document-search/infra/main.bicep" --location JapanEast -p vmLoginPassword=dummy -p resourceGroupName=rg-${{ github.run_id }} -p isPrivateNetworkEnabled=false -p environmentName=${{ github.run_id }} -p location=japaneast 2>&1)
echo "$results"
# Check if "Error" is present in $results
if echo "$results" | grep "Error"; then
if echo "$results" | grep -i "Error"; then
echo "Error found in what-if results. Exiting..."
exit 1
fi
Expand All @@ -46,7 +47,7 @@ jobs:
$ENV:COGNITIVE_SERVICES_NAME = "cog-${{ github.run_id }}"
cd 5.internal-document-search/infra
$results = az deployment sub create --name $ENV:DEP_NAME --location $ENV:LOC --template-file main.bicep --parameters principalId=$ENV:AZURE_PRINCIPAL_ID environmentName=$ENV:AZURE_ENV_NAME location=$ENV:LOC backendServiceName=$ENV:BACKEND_SERVICE_NAME appServicePlanName=$ENV:APP_SERVICE_PLAN_NAME storageAccountName=$ENV:STORAGE_ACCOUNT_NAME searchServiceName=$ENV:SEARCH_SERVICE_NAME formRecognizerServiceName=$ENV:FORMRECOGNIZER_SERVICE_NAME openAiServiceName=$ENV:COGNITIVE_SERVICES_NAME vmLoginPassword=dummy isPrivateNetworkEnabled=false
$results = az deployment sub create --name $ENV:DEP_NAME --location $ENV:LOC --template-file main.bicep --parameters principalId=$ENV:AZURE_PRINCIPAL_ID environmentName=$ENV:AZURE_ENV_NAME location=$ENV:LOC backendServiceName=$ENV:BACKEND_SERVICE_NAME appServicePlanName=$ENV:APP_SERVICE_PLAN_NAME storageAccountName=$ENV:STORAGE_ACCOUNT_NAME searchServiceName=$ENV:SEARCH_SERVICE_NAME formRecognizerServiceName=$ENV:FORMRECOGNIZER_SERVICE_NAME openAiServiceName=$ENV:COGNITIVE_SERVICES_NAME vmLoginPassword=dummy isPrivateNetworkEnabled=false cosmosDBAccountName=$ENV:AZURE_COSMOSDB_ACCOUNT 2>&1 | Out-String
echo "$results"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/5.what-if.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:

- name: what-if using Azure CLI
run: |
results=$(az deployment sub what-if --template-file "./5.internal-document-search/infra/main.bicep" --location JapanEast -p vmLoginPassword=dummy -p resourceGroupName=rg-${{ github.run_id }} -p isPrivateNetworkEnabled=false -p environmentName=${{ github.run_id }} -p location=japaneast)
set +e
results=$(az deployment sub what-if --template-file "./5.internal-document-search/infra/main.bicep" --location JapanEast -p vmLoginPassword=dummy -p resourceGroupName=rg-${{ github.run_id }} -p isPrivateNetworkEnabled=false -p environmentName=${{ github.run_id }} -p location=japaneast 2>&1)
echo "$results"
# Check if "Error" is present in $results
if echo "$results" | grep "Error"; then
if echo "$results" | grep -i "Error"; then
echo "Error found in what-if results. Exiting..."
exit 1
fi
3 changes: 2 additions & 1 deletion 5.internal-document-search/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ param formRecognizerResourceGroupLocation string = location

param formRecognizerSkuName string = 'S0'

param cosmosDBAccountName string = ''
param cosmosDbDatabaseName string = 'ChatHistory'
param cosmosDbContainerName string = 'Prompts'

Expand Down Expand Up @@ -108,7 +109,7 @@ module cosmosDb 'core/db/cosmosdb.bicep' = {
name: 'cosmosdb'
scope: resourceGroup
params: {
name: '${abbrs.documentDBDatabaseAccounts}${resourceToken}'
name: !empty(cosmosDBAccountName) ? cosmosDBAccountName : '${abbrs.documentDBDatabaseAccounts}${resourceToken}'
location: location
tags: union(tags, { 'azd-service-name': 'cosmosdb' })
cosmosDbDatabaseName: cosmosDbDatabaseName
Expand Down

0 comments on commit 1d58f2b

Please sign in to comment.