-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbicep2.yml
84 lines (73 loc) · 2.46 KB
/
bicep2.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
73
74
75
76
77
78
79
80
81
82
83
84
name: Deploy Bicep files $(Build.BuildId)
trigger: none
# - main
variables:
resourceGroupName: 'rg-bicep-demo-0023'
location: 'australiasoutheast'
webAppName: 'bicep0023'
templateFile: '01-bicep-webapp/webapp-linux.bicep'
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: preDeploy
jobs:
- job: scanWhatif
displayName: scan and run whatif
pool:
vmImage: windows-2022
steps:
- task: RunARMTTKTests@1
displayName: Scan Bicep files
inputs:
templatelocation: '$(System.DefaultWorkingDirectory)\01-bicep-webapp'
resultLocation: '$(System.DefaultWorkingDirectory)\results'
allTemplatesMain: false
cliOutputResults: true
ignoreExitCode: true
- task: PublishTestResults@2
displayName: Publish Results
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '$(System.DefaultWorkingDirectory)\results\*-armttk.xml'
condition: always()
- task: AzureCLI@2
displayName: Preview Bicep Changes
inputs:
azureSubscription: 'Microsoft-Azure-0(17b12858-3960-4e6f-a663-a06fdae23428)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az --version
az group create --name $(resourceGroupName) --location $(location)
az deployment group what-if --resource-group $(resourceGroupName) \
--template-file $(templateFile) \
--parameters webAppName=$(webAppName)
- stage: deployBicep
jobs:
- job: waitForValidation
displayName: Wait for external validation
pool: server
timeoutInMinutes: 4320 # job times out in 3 days
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: '[email protected]'
instructions: 'Please validate the build $(Build.BuildId) configuration and resume'
onTimeout: 'resume'
- job: deployAzure
displayName: deploy bicep to Azure
pool:
vmImage: 'ubuntu-latest'
dependsOn: [waitForValidation]
steps:
- task: AzureCLI@2
displayName: Deploy Bicep To Azure
inputs:
azureSubscription: 'Microsoft-Azure-0(17b12858-3960-4e6f-a663-a06fdae23428)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --resource-group $(resourceGroupName) \
--template-file $(templateFile) \
--parameters webAppName=$(webAppName)