Skip to content

Commit

Permalink
feat(azure-go): create a script to get and retrieve the currently fun…
Browse files Browse the repository at this point in the history
…ction outboundIpAddresses list

- added the list of outboundIpAddresses to the deployment overrideParameters
  • Loading branch information
luizjhonata committed Oct 18, 2024
1 parent ae09020 commit 69175ed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Exceptions are acceptable depending on the circumstances (critical bug fixes tha
- added command to run rename_vars.sh file
- added management step for Azure DevOps environment
- added a new step to publish the code coverage for `azure-devops`
- added a new task in `azure-devops/golang/delivery` to retrieve list of `outboundIPAddresses`
- added the list of `outboundIPAddresses` to the `overrideParameters` in the `AzureResourceGroupDeployment@2` task

### Changed

Expand Down
20 changes: 19 additions & 1 deletion azure-devops/golang/stages/40-delivery/arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ stages:
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
includeRootFolder: false
replaceExistingArchive: true
- task: AzureCLI@2
displayName: 'Getting outboundIpAddresses'
inputs:
azureSubscription: '$(AZM_SERVICE_CONNECTION)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
resourceGroupName=$(ENVIRONMENT)-rg-$(AZM_FUNCTION_NAME)-$(AZM_LOCATION)
az --version
functionAppName=$(az functionapp list --resource-group $resourceGroupName --query "[].name" --output tsv)
echo "Function App name: $functionAppName"
outboundIPAddresses=$(az webapp show --resource-group $resourceGroupName --name $functionAppName --query outboundIpAddresses --output tsv)
echo "List of outbound IPs: $outboundIPAddresses"
echo "##vso[task.setvariable variable=outboundIPAddresses]$outboundIPAddresses"
# TODO: this should be the deployment stage
- task: 'AzureResourceGroupDeployment@2'
inputs:
Expand All @@ -43,7 +61,7 @@ stages:
azureSubscription: '$(AZM_SERVICE_CONNECTION)'
resourceGroupName: '$(ENVIRONMENT)-rg-$(AZM_FUNCTION_NAME)-$(AZM_LOCATION)'
csmFile: 'azuredeploy.json'
overrideParameters: '-location $(AZM_LOCATION) -environment $(ENVIRONMENT) -functionAppName $(AZM_FUNCTION_NAME) -inboundAllowedIps $(INBOUND_ALLOWED_IPS)'
overrideParameters: '-location $(AZM_LOCATION) -environment $(ENVIRONMENT) -functionAppName $(AZM_FUNCTION_NAME) -inboundAllowedIps $(INBOUND_ALLOWED_IPS) -oldOutboundIpAddresses $(outboundIPAddresses)'
templateLocation: 'Linked artifact'
deploymentMode: 'Incremental'
deploymentOutputs: 'OUTPUTS'
Expand Down

0 comments on commit 69175ed

Please sign in to comment.