This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines.yml
94 lines (78 loc) · 2.51 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
resources:
- repo: self
clean: true
trigger:
batch: true
branches:
include:
- master
- feature/*
- release/*
name: $(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
jobs:
- job: job_1
displayName: Chef Linting and Unit Tests
pool:
name: ApexInfra Linux
steps:
- task: chef-software.vsts-chef-tasks.vsts-chef-task-install-chefdk.vsts-chef-task-install-chefdk@1
displayName: 'Install ChefDK (Current)'
inputs:
chefDKForceInstall: true
- template: pipelines/templates/install-chef-gems.yml
parameters:
gem: webmock
- template: pipelines/templates/install-chef-gems.yml
parameters:
gem: chef-vault-testfixtures
- script: 'chef exec cookstyle --extra-details --no-color'
displayName: Run Chef Cookstyle
failOnStderr: true
- script: 'chef exec foodcritic .'
displayName: Run Foodcritic
failOnStderr: true
- script: 'chef exec rspec --no-color --format RspecJunitFormatter --out /tmp/rspec.xml'
displayName: Run ChefSpec
failOnStderr: true
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
testResultsFiles: /tmp/rspec.xml
- job: job_2
displayName: Chef Integration Tests
dependsOn: job_1
condition: succeeded()
pool:
name: ApexInfra Linux
steps:
- script: echo '##vso[task.setvariable variable=SNIPEIT_TOKEN]$(snipeit-test-api-token)'
displayName: Set the SNIPEIT_TOKEN variable
- task: chef-software.vsts-chef-tasks.vsts-chef-task-install-chefdk.vsts-chef-task-install-chefdk@1
displayName: 'Install ChefDK'
inputs:
chefDKForceInstall: true
chefDKChannel: stable
- task: chef-software.vsts-chef-tasks.vsts-chef-task-test-kitchen.vsts-chef-task-test-kitchen@1
displayName: 'Execute Test Kitchen: test'
inputs:
tkAzureEndpoint: 'Apex Lab - CorpNet'
tkCommand: test
tkKitchenFile: kitchen.yml
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
testResultsFiles: /tmp/inspec.xml
- task: chef-software.vsts-chef-tasks.vsts-chef-task-test-kitchen.vsts-chef-task-test-kitchen@1
displayName: 'Execute Test Kitchen: destroy'
inputs:
tkAzureEndpoint: 'Apex Lab - CorpNet'
tkCommand: destroy
tkKitchenFile: kitchen.yml
condition: always()
- task: SSH@0
displayName: 'Purge the soft deletes from the Snipe-IT test instance'
condition: always()
inputs:
sshEndpoint: snipeit-test-endpoint
runOptions: inline
inline: 'cd /var/www/snipeit; php artisan snipeit:purge -n --force=true'