-
Notifications
You must be signed in to change notification settings - Fork 513
/
alz-bicep-4a-hubspoke.yml
72 lines (64 loc) · 2.55 KB
/
alz-bicep-4a-hubspoke.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: ALZ-Bicep-4A-HubSpoke
trigger:
# YAML PR triggers are supported only in GitHub and Bitbucket Cloud.
# If you use Azure Repos Git, you can configure a branch policy for build validation to trigger your build pipeline for validation.
# https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies#build-validation
branches:
include:
- "main"
paths:
include:
- "config/custom-parameters/resourceGroupConnectivity.parameters.all.json"
- "config/custom-parameters/hubNetworking.parameters.all.json"
pr:
branches:
include:
- "main"
paths:
include:
- "config/custom-parameters/resourceGroupConnectivity.parameters.all.json"
- "config/custom-parameters/hubNetworking.parameters.all.json"
variables:
ENV_FILE: ".env"
SERVICE_CONNECTION_NAME: "[your service connection name here]"
IS_PULL_REQUEST: "false"
jobs:
- job: ALZ_Bicep_4A_HubSpoke
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
displayName: Checkout Repo
- pwsh: |
(Get-Content -Path $env:ENV_FILE -Encoding UTF8) | ForEach-Object {$_ -replace '"',''} | Out-File -FilePath $env:ENV_FILE -Encoding UTF8
displayName: Remove Quotation Marks from Environment File
- pwsh: |
Write-Host $env:ENV_FILE
Get-Content -Path $env:ENV_FILE -Encoding UTF8 | ForEach-Object {
$envVarName, $envVarValue = ($_ -replace '"','').split('=')
echo "##vso[task.setvariable variable=$envVarName;]$envVarValue"
echo "Set $envVarName to $envVarValue]"
}
displayName: Import Environment Variables from File
- pwsh: |
echo "##vso[task.setvariable variable=IS_PULL_REQUEST;]true"
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Set IS_PULL_REQUEST Variable to True
- task: AzurePowerShell@5
displayName: "Connectivity Resource Group Deployment"
inputs:
azureSubscription: ${{ variables.SERVICE_CONNECTION_NAME }}
azurePowerShellVersion: "LatestVersion"
pwsh: true
ScriptType: "InlineScript"
Inline: |
.\pipeline-scripts\Deploy-ALZConnectivityResourceGroup.ps1
- task: AzurePowerShell@5
displayName: "Hub (Hub-and-Spoke) Deployment"
inputs:
azureSubscription: ${{ variables.SERVICE_CONNECTION_NAME }}
azurePowerShellVersion: "LatestVersion"
pwsh: true
ScriptType: "InlineScript"
Inline: |
.\pipeline-scripts\Deploy-ALZHub-HubAndSpoke.ps1