-
Notifications
You must be signed in to change notification settings - Fork 641
/
01-terraform-azure-devops-ci-pipeline.yml
39 lines (37 loc) · 1.57 KB
/
01-terraform-azure-devops-ci-pipeline.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
trigger:
- main
# Stages
# Stage-1:
# Task-1: Copy terraform-manifests files to Build Artifact Directory
# Task-2: Publish build articats to Azure Pipelines
# Pipeline Hierarchial Flow: Stages -> Stage -> Jobs -> Job -> Steps -> Task1, Task2, Task3
stages:
# Build Stage
- stage: Build
displayName: Build Stage
jobs:
- job: Build
displayName: Build Job
pool:
vmImage: 'ubuntu-latest'
steps:
## Publish Artifacts pipeline code in addition to Build and Push
- bash: echo Contents in System Default Working Directory; ls -R $(System.DefaultWorkingDirectory)
- bash: echo Before copying Contents in Build Artifact Directory; ls -R $(Build.ArtifactStagingDirectory)
# Task-1: Copy files (Copy files from a source folder to target folder)
# Source Directory: $(System.DefaultWorkingDirectory)/terraform-manifests
# Target Directory: $(Build.ArtifactStagingDirectory)
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/terraform-manifests'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
OverWrite: true
# List files from Build Artifact Staging Directory - After Copy
- bash: echo After copying to Build Artifact Directory; ls -R $(Build.ArtifactStagingDirectory)
# Task-2: Publish build artifacts (Publish build to Azure Pipelines)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'terraform-manifests'
publishLocation: 'Container'