-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
97 lines (90 loc) · 3.01 KB
/
Copy pathazure-pipelines.yml
File metadata and controls
97 lines (90 loc) · 3.01 KB
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
85
86
87
88
89
90
91
92
# Azure Pipeline.
name: $(Date:yyyyMMdd).$(Rev:.r)
trigger:
batch: true
branches:
include:
- master
stages:
- stage: dev
variables:
- group: dev_terraform
displayName: dev
jobs:
- job: init
pool:
vmImage: 'ubuntu-16.04' # Other options: 'macOS-10.13', 'vs2017-win2016'
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: $(env).auto.tfvars
- script: terraform fmt -check=true
displayName: Check terraform is formatted correctly
- bash: ln -s $(Agent.TempDirectory)/$(env).auto.tfvars ./$(env).auto.tfvars
displayName: place variables
- task: AzureCLI@1
displayName: Init
inputs:
azureSubscription: $(azure_sub)
scriptLocation: 'scriptPath' # Options: inlineScript, scriptPath
scriptPath: ./init.sh
arguments: -e $(env) -c $(cluster_name)
- task: PublishPipelineArtifact@1
inputs:
path: $(System.DefaultWorkingDirectory)/.terraform
artifactName: init
- bash: rm -rf ./$(env).auto.tfvars
displayName: remove variables
- job: plan
dependsOn: init
pool:
vmImage: 'ubuntu-16.04' # Other options: 'macOS-10.13', 'vs2017-win2016'
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: $(env).auto.tfvars
- bash: mkdir .terraform
displayName: init landing location
- task: DownloadPipelineArtifact@2
inputs:
artifact: init
path: $(System.DefaultWorkingDirectory)/.terraform
- bash: ln -sf $(Agent.TempDirectory)/$(env).auto.tfvars ./$(env).auto.tfvars
displayName: place variables
- bash: chmod +x .terraform/plugins/linux_amd64/*.*
displayName: plugin permissions
- task: AzureCLI@1
displayName: Plan
inputs:
azureSubscription: $(azure_sub)
scriptLocation: 'scriptPath' # Options: inlineScript, scriptPath
scriptPath: ./plan.sh
arguments: -e $(env) -c $(cluster_name)
- task: PublishPipelineArtifact@1
inputs:
path: $(System.DefaultWorkingDirectory)/$(env).plan
artifactName: plan
- job: Deploy
dependsOn: plan
pool:
vmImage: 'ubuntu-16.04' # Other options: 'macOS-10.13', 'vs2017-win2016'
steps:
- bash: mkdir .terraform
displayName: init landing location
- task: DownloadPipelineArtifact@2
inputs:
artifact: init
path: $(System.DefaultWorkingDirectory)/.terraform
- bash: chmod +x .terraform/plugins/linux_amd64/*.*
displayName: plugin permissions
- task: DownloadPipelineArtifact@2
inputs:
artifact: plan
path: $(System.DefaultWorkingDirectory)
- task: AzureCLI@1
displayName: Apply
inputs:
azureSubscription: $(azure_sub)
scriptLocation: 'scriptPath' # Options: inlineScript, scriptPath
scriptPath: ./apply.sh
arguments: -e $(env)