Skip to content

Instantly share code, notes, and snippets.

@gambtho
Created July 8, 2019 21:14
Show Gist options
  • Save gambtho/7aa816251d3bc8e438f87e7e75de3b89 to your computer and use it in GitHub Desktop.
Save gambtho/7aa816251d3bc8e438f87e7e75de3b89 to your computer and use it in GitHub Desktop.
# Azure Pipeline.
# optional
variables:
- group: some_resource_group
name: $(Date:yyyyMMdd).$(Rev:.r)
trigger:
batch: true
# choose which branches to build automatically
branches:
include:
- master
jobs:
- job: Plan
pool:
vmImage: 'ubuntu-16.04' # Other options: 'macOS-10.13', 'vs2017-win2016'
steps:
# use ado secure file for keeping secrets
- task: DownloadSecureFile@1
inputs:
secureFile: terraform.tfvars
# enforce formatting
- script: terraform fmt -check=true
displayName: Check terraform is formatted correctly
- bash: cp $(Agent.TempDirectory)/terraform.tfvars .
displayName: place variables
- task: AzureCLI@1
displayName: Init
# variables are used to allow for deploying to different envs and keep names unique
inputs:
azureSubscription: $(azureSub)
scriptLocation: 'scriptPath' # Options: inlineScript, scriptPath
scriptPath: ./init.sh
arguments: -a $(cluster_name)$(env) -e $(env) -g $(cluster_name)$(env)
- task: AzureCLI@1
displayName: Plan
inputs:
azureSubscription: $(azureSub)
scriptLocation: 'scriptPath' # Options: inlineScript, scriptPath
scriptPath: ./plan.sh
arguments: -a $(cluster_name)$(env) -e $(env) -g $(cluster_name)$(env)
- script: rm -rf .terraform && rm -rf .git && cp -r . $(Build.StagingDirectory)
displayName: clean-up && copy src files to staging dir
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: $(env)-drop
publishLocation: 'Container' # Options: container, filePath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment