-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
66 lines (64 loc) · 2.4 KB
/
azure-pipelines.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
trigger:
branches:
include:
- master
variables:
keyvault_name: "infraautomator-keyvault"
automation_account_name: "dev-playground"
resource_group_name: "dev_playground"
## This is only split into job so that the DSC configuration is run on Windows
# jobs:
# - job: InfrastructureBuild
steps:
- task: AzureKeyVault@1
displayName: "Download the Keyvault secrets"
inputs:
azureSubscription: 'ARM'
KeyVaultName: $(keyvault_name)
SecretsFilter: 'vmAdminUsername,vmAdminPassword'
- task: TerraformCLI@0
displayName: "Download Terraform providers"
inputs:
command: 'init'
- task: TerraformCLI@0
displayName: "Test Terraform plan"
inputs:
command: 'plan'
environmentServiceName: 'ARM'
commandOptions: '-input=false --var="vmAdminUsername=$(vmAdminUsername)" --var="vmAdminPassword=$(vmAdminPassword)"'
- task: TerraformCLI@0
displayName: "Build the VM"
inputs:
command: 'apply'
environmentServiceName: 'ARM'
commandOptions: '-input=false --var="vmAdminUsername=$(vmAdminUsername)" --var="vmAdminPassword=$(vmAdminPassword)"'
# - job: VMConfiguration
# dependsOn:
# - InfrastructureBuild
# pool:
# vmImage: "windows-latest"
# steps:
- task: AzurePowerShell@5
displayName: "Import the DSC configuration"
inputs:
azureSubscription: 'ARM'
ScriptType: 'FilePath'
ScriptPath: '$(System.DefaultWorkingDirectory)/compile_dsc.ps1'
ScriptArguments: '-AzureAutomationAccountName $(automation_account_name) -ResourceGroup $(resource_group_name) -ScriptFilePath "$(System.DefaultWorkingDirectory)\iis.ps1"'
FailOnStandardError: true
azurePowerShellVersion: 'LatestVersion'
- task: AzurePowerShell@5
displayName: "Run the infrastructure tests"
inputs:
azureSubscription: 'ARM'
ScriptType: 'FilePath'
ScriptPath: '$(System.DefaultWorkingDirectory)/tests/invoke-test.ps1'
ScriptArguments: '-TestScriptFilePath "$(System.DefaultWorkingDirectory)/tests/vm.tests.ps1" -TestResultsFilePath "$(System.DefaultWorkingDirectory)/tests/results.xml"'
FailOnStandardError: true
azurePowerShellVersion: 'LatestVersion'
- task: PublishTestResults@2
displayName: "Publish the test results to the pipeline"
inputs:
testResultsFormat: "NUnit"
testResultsFiles: "$(System.DefaultWorkingDirectory)/tests/results.xml"
failTaskOnFailedTests: true