forked from puppetlabs/puppet-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
110 lines (94 loc) · 3.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Don't run Azure when a branch is updated, only when a PR is updated.
# Prevents double builds when a PR is made from the main repo and not a fork.
trigger: none
pr:
autoCancel: true
branches:
include:
- '*'
pool:
# self-hosted agent on Windows 10 1903 environment
# includes newer Docker engine with LCOW enabled, new build of LCOW image
# includes Ruby 2.5, Go 1.10, Node.js 10.10
name: Default
variables:
NAMESPACE: puppet
CONTAINER_NAME: puppet-agent-ubuntu
CONTAINER_NAME2: puppet-agent-alpine
LINT_IGNORES: DL3008 DL3018 DL4000 DL4001 DL3028
workspace:
clean: resources
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: true # whether to fetch clean each time
- powershell: |
$gemfile = Join-Path -Path (Get-Location) -ChildPath 'docker/Gemfile'
$gempath = Join-Path -Path (Get-Location) -ChildPath 'docker/.bundle/gems'
bundle config --local gemfile $gemfile
bundle config --local path $gempath
bundle install
displayName: Fetch Dependencies
name: fetch_deps
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Write-HostDiagnostics
displayName: Diagnostic Host Information
name: hostinfo
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Lint-Dockerfile -Name $ENV:CONTAINER_NAME2 -Ignore ($ENV:LINT_IGNORES -split ' ')
displayName: Lint $(CONTAINER_NAME2) Dockerfile
name: lint_alpine_dockerfile
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Lint-Dockerfile -Name $ENV:CONTAINER_NAME -Ignore ($ENV:LINT_IGNORES -split ' ')
displayName: Lint $(CONTAINER_NAME) Dockerfile
name: lint_dockerfile
- powershell: |
. ./docker/ci/build.ps1
Build-Container -Namespace $ENV:NAMESPACE -Base 'ubuntu'
displayName: Build $(CONTAINER_NAME) Container
name: build_container
- powershell: |
. ./docker/ci/build.ps1
Build-Container -Namespace $ENV:NAMESPACE -Base 'alpine'
displayName: Build $(CONTAINER_NAME2) Container
name: build_alpine_container
enabled: false
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Initialize-TestEnv
displayName: Prepare Test Environment
name: test_prepare
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Invoke-ContainerTest -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE
displayName: Test $(CONTAINER_NAME)
name: test_container
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
Invoke-ContainerTest -Name $ENV:CONTAINER_NAME2 -Namespace $ENV:NAMESPACE
displayName: Test $(CONTAINER_NAME2)
name: test_alpine_container
enabled: false
- task: PublishTestResults@2
displayName: Publish $(CONTAINER_NAME) test results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'docker/TEST-*.xml'
testRunTitle: $(CONTAINER_NAME) Test Results
- task: PublishTestResults@2
displayName: Publish $(CONTAINER_NAME2) test results
enabled: false
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'docker/TEST-*.xml'
testRunTitle: $(CONTAINER_NAME2) Test Results
- powershell: |
. "$(bundle show pupperware)/ci/build.ps1"
# builds alias puppet-agent to puppet-agent-ubuntu which requires forced removal
Clear-BuildState -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE -Force
Clear-BuildState -Name $ENV:CONTAINER_NAME2 -Namespace $ENV:NAMESPACE
displayName: Container Cleanup
timeoutInMinutes: 3
condition: always()