Skip to content

Commit

Permalink
Add new review API settings to BICEP file and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Recep Ozkurt committed Dec 18, 2023
1 parent b4e4fe4 commit 36f6a19
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ on:
resourceGroupName:
required: true
type: string
reviewApiUrl:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
reviewApiKey:
required: true

jobs:
validate:
Expand All @@ -37,6 +42,8 @@ jobs:
template: ./deploy/main.bicep
parameters: >
environmentType=${{ inputs.environmentType }}
reviewApiUrl=${{ inputs.reviewApiUrl }}
reviewApiKey=${{ secrets.reviewApiKey }}
deploymentMode: Validate
- if: inputs.environmentType == 'Production'
uses: azure/arm-deploy@v1
Expand All @@ -47,6 +54,8 @@ jobs:
template: ./deploy/main.bicep
parameters: >
environmentType=${{ inputs.environmentType }}
reviewApiUrl=${{ inputs.reviewApiUrl }}
reviewApiKey=${{ secrets.reviewApiKey }}
additionalArguments: --what-if

deploy:
Expand All @@ -73,6 +82,8 @@ jobs:
template: ./deploy/main.bicep
parameters: >
environmentType=${{ inputs.environmentType }}
reviewApiUrl=${{ inputs.reviewApiUrl }}
reviewApiKey=${{ secrets.reviewApiKey }}
smoke-test:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ jobs:
with:
environmentType: Test
resourceGroupName: ToyWebsiteTest
reviewApiUrl: https://sandbox.contoso.com/reviews
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_TEST }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
reviewApiKey: ${{ secrets.REVIEW_API_KEY_TEST }}
# Deploy to the production environment.
deploy-production:
uses: ./.github/workflows/deploy.yml
needs: deploy-test
with:
environmentType: Production
resourceGroupName: ToyWebsiteProduction
reviewApiUrl: https://api.contoso.com/reviews
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_PRODUCTION }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
reviewApiKey: ${{ secrets.REVIEW_API_KEY_TEST }}
15 changes: 15 additions & 0 deletions deploy/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ param environmentType string
@maxLength(13)
param resourceNameSuffix string = uniqueString(resourceGroup().id)

@description('The URL to the product review API.')
param reviewApiUrl string

@secure()
@description('The API key to use when accessing the product review API.')
param reviewApiKey string

// Define the names for resources.
var appServiceAppName = 'toy-website-${resourceNameSuffix}'
var appServicePlanName = 'toy-website'
Expand Down Expand Up @@ -70,6 +77,14 @@ resource appServiceApp 'Microsoft.Web/sites@2022-03-01' = {
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: applicationInsights.properties.ConnectionString
}
{
name: 'ReviewApiUrl'
value: reviewApiUrl
}
{
name: 'ReviewApiKey'
value: reviewApiKey
}
]
}
}
Expand Down

0 comments on commit 36f6a19

Please sign in to comment.