-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
142 lines (127 loc) · 3.98 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
trigger:
batch: true
branches:
include:
- main
pr:
branches:
include:
- main
schedules:
- cron: '0 0 * * 0'
displayName: Weekly build
branches:
include:
- main
always: true
resources:
repositories:
- repository: OpsGuildAutomationRepo
type: git
name: DevOps/opsguild.automation
ref: refs/heads/main
- repository: templates
type: github
name: AVEVA/AVEVA-Samples
endpoint: AVEVA
variables:
- name: analysisProject
value: Deployment_OnPrem
parameters:
- name: pool
default: DevOps Managed Containers Build
- name: containerDemands
type: object
default: ['Agent.OS -equals Windows_NT']
jobs:
- job: Tests
condition: ne(variables['Build.Reason'], 'Schedule')
strategy:
matrix:
server2016:
vmName: PRGPSDSRV16
windows10:
vmName: PRGPSDWIN10
pool:
name: ${{ parameters.pool }}
demands: ${{ parameters.containerDemands }}
steps:
- task: ms-vscs-rm.scvmmapp.scvmmresourcedeployment-task.SCVMM@1
inputs:
ConnectedServiceName: 'product-readiness.SCVMM'
VMList: $(vmName)
CheckPointName: Initial
ScopeFilter: CloudFiltering
CloudFilter: OAK
CreateBoundaryVM: false
NoDetailedLogs: false
displayName: 'SCVMM: Restore VM Checkpoint'
- task: ms-vscs-rm.scvmmapp.scvmmresourcedeployment-task.SCVMM@1
inputs:
ConnectedServiceName: 'product-readiness.SCVMM'
VMList: $(vmName)
Action: StartVM
ScopeFilter: CloudFiltering
CloudFilter: OAK
CreateBoundaryVM: false
NoDetailedLogs: false
displayName: 'SCVMM: Start VM'
# Download secrets from Azure Key Vault
- task: AzureKeyVault@2
inputs:
azureSubscription: '$(azureSubscription)'
KeyVaultName: 'Github-Samples'
SecretsFilter: 'Username3, Password3'
RunAsPreJob: false
- task: WindowsMachineFileCopy@2
inputs:
sourcePath: $(Build.SourcesDirectory)
machineNames: $(vmName)
targetPath: 'C:\Test'
adminUserName: $(Username3)
adminPassword: $(Password3)
displayName: 'Copy PowerShell script'
- task: PowerShellOnTargetMachines@3
inputs:
machines: $(vmName)
communicationProtocol: http
scriptType: filePath
scriptPath: 'C:\Test\Install-PIServer.ps1'
scriptArguments: '-sql .\SQL\SETUP.EXE -piserver .\PIServer.exe -pilicdir C:\Test -afdatabase TestDatabase -pibundle .\PIProcessBook.exe -remote'
workingDirectory: 'C:\Test'
userName: $(Username3)
userPassword: $(Password3)
displayName: 'Run PowerShell script'
- task: PowerShellOnTargetMachines@3
inputs:
machines: $(vmName)
communicationProtocol: http
scriptType: filePath
scriptPath: 'C:\Test\Verify-PIServer.ps1'
userName: $(Username3)
userPassword: $(Password3)
displayName: 'Run tests'
- task: ms-vscs-rm.scvmmapp.scvmmresourcedeployment-task.SCVMM@1
inputs:
ConnectedServiceName: 'product-readiness.SCVMM'
VMList: $(vmName)
Action: StopVM
ScopeFilter: CloudFiltering
CloudFilter: OAK
CreateBoundaryVM: false
NoDetailedLogs: false
displayName: 'SCVMM: Stop VM'
condition: always()
- job: Code_Analysis
pool:
name: ${{ parameters.pool }}
demands: ${{ parameters.containerDemands }}
steps:
- powershell: Install-Module -Name PSScriptAnalyzer -Force
displayName: Install code analyzer
- powershell: Invoke-ScriptAnalyzer -EnableExit -Path ./ -Recurse
failOnStderr: true
displayName: Run analysis
- template: '/miscellaneous/build_templates/code-analysis.yml@templates'
parameters:
skipPolaris: true