-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into snyk-fix-0da9a9db8cde2739a67c033a3d8747c7
# Conflicts: # src/backend/api/Fusion.Resources.Domain/Fusion.Resources.Domain.csproj
- Loading branch information
Showing
57 changed files
with
437 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# | ||
# Template for deploying pull request function app. | ||
# | ||
# Done this instead of making one template to include all ifs-and-buts. | ||
# | ||
|
||
|
||
parameters: | ||
envName: '' | ||
clientId: '' | ||
pullRequestNumber: '' | ||
fusionResource: '5a842df8-3238-415d-b168-9f16a6a6031b' | ||
templateFile: $(Build.SourcesDirectory)/src/backend/function/Fusion.Resources.Functions/Deployment/function.template.json | ||
disabledFunctionsFile: $(Build.SourcesDirectory)/src/backend/function/Fusion.Resources.Functions/Deployment/disabled-functions.json | ||
|
||
steps: | ||
- checkout: self | ||
- task: AzurePowerShell@4 | ||
displayName: 'Deploy Function ARM template' | ||
inputs: | ||
azureSubscription: 'PROJECT_PORTAL (63b791ae-b2bc-41a1-ac66-806c4e69bffe)' | ||
ScriptType: 'InlineScript' | ||
FailOnStandardError: true | ||
azurePowerShellVersion: 'LatestVersion' | ||
Inline: | | ||
# | ||
# Hardcoded to PR env | ||
# | ||
$environment = "pr" | ||
$pullRequestNumber = "${{ parameters.pullRequestNumber }}" | ||
$fusionEnvironment = "ci" | ||
$functionAppName = "func-fap-resources-$environment" | ||
$envVaultName = "kv-fap-resources-$environment" | ||
$envResourceGroup = Get-AzResourceGroup -Tag @{ "fusion-app-component" = "resources-rg-$environment" } | ||
if ($envResourceGroup -eq $null) { throw "Cannot locate resource group for environment '$environment'" } | ||
$resourceGroup = $envResourceGroup.ResourceGroupName | ||
Write-Host "Using resource group $resourceGroup" | ||
# | ||
# Generate the app settings | ||
# | ||
# Sett correct resources URI based on environment | ||
$resourcesFunctionUri = "https://resources-api-pr-$pullRequestNumber.fusion-dev.net/" | ||
$settings = @{ | ||
clientId = "${{ parameters.clientId }}" | ||
secretIds = @{ | ||
clientSecret = "https://$envVaultName.vault.azure.net:443/secrets/AzureAd--ClientSecret" | ||
serviceBus = "https://$envVaultName.vault.azure.net:443/secrets/Connectionstrings--ServiceBus" | ||
} | ||
endpoints = @{ | ||
lineorg = "https://fusion-s-lineorg-$fusionEnvironment.azurewebsites.net" | ||
org = "https://fusion-s-org-$fusionEnvironment.azurewebsites.net" | ||
people = "https://fusion-s-people-$fusionEnvironment.azurewebsites.net" | ||
resources = "$resourcesFunctionUri" | ||
notifications = "https://fusion-s-notification-$fusionEnvironment.azurewebsites.net" | ||
context = "https://fusion-s-context-$fusionEnvironment.azurewebsites.net" | ||
portal = "https://fusion-s-portal-$fusionEnvironment.azurewebsites.net" | ||
} | ||
resources = @{ | ||
fusion = "${{ parameters.fusionResource }}" | ||
} | ||
queues = @{ | ||
provisionPosition = "provision-position" | ||
} | ||
} | ||
New-AzResourceGroupDeployment -Mode Incremental -Name "resources-function" -ResourceGroupName $resourceGroup -TemplateFile "${{ parameters.templateFile }}" ` | ||
-env-name $environment ` | ||
-settings $settings | ||
$functionApp = Get-AzWebApp -ResourceGroupName $resourceGroup -Name $functionAppName | ||
Set-AzKeyVaultAccessPolicy -VaultName $envVaultName -ResourceGroupName $resourceGroup -ObjectId $functionApp.Identity.PrincipalId -PermissionsToSecrets get | ||
## Load disabled functions | ||
$disabledFunctionConfig = ConvertFrom-Json (Get-Content "${{ parameters.disabledFunctionsFile }}" -Raw) | ||
$disabledFunctions = $disabledFunctionConfig | where -Property environment -eq $environment | Select -expandproperty disabledFunctions | ||
Write-Host "Disabled functions" | ||
$disabledFunctions | ||
$settings = @{} | ||
ForEach ($kvp in $functionApp.SiteConfig.AppSettings) { | ||
$settings[$kvp.Name] = $kvp.Value | ||
} | ||
## Mark functions as disabled | ||
$disabledFunctions | ForEach-Object { $settings["AzureWebJobs.$_.Disabled"] = "true" } | ||
## Update web app settings for function app | ||
Set-AzWebApp -ResourceGroupName $resourceGroup -Name $functionAppName -AppSettings $settings | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.