forked from dsccommunity/DscWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines On-Prem.yml
91 lines (78 loc) · 3.05 KB
/
azure-pipelines On-Prem.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
name: $(BuildID)
trigger:
- '*'
pool:
name: Default
workspace:
clean: all
variables:
GalleryUri: ggggg #will be replaced during lab deployment
Domain: ddddd #will be replaced during lab deployment
UserName: uuuuu #will be replaced during lab deployment
Password: ppppp #will be replaced during lab deployment
steps:
- task: PowerShell@2
displayName: Register PowerShell Gallery
inputs:
targetType: inline
script: |
#always make sure the local PowerShell Gallery is registered correctly
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$uri = '$(GalleryUri)'
$name = 'PowerShell'
$domain = '$(Domain)'
$userName = '$(UserName)'
$password = '$(Password)'
$cred = New-Object pscredential("$domain\$userName", ($password | ConvertTo-SecureString -AsPlainText -Force))
$r = Get-PSRepository -Name $name -ErrorAction SilentlyContinue
if (-not $r -or $r.SourceLocation -ne $uri -or $r.PublishLocation -ne $uri) {
Write-Host "The Source or PublishLocation of the repository '$name' is not correct or the repository is not registered"
Unregister-PSRepository -Name $name -ErrorAction SilentlyContinue
Register-PSRepository -Name $name -SourceLocation $uri -PublishLocation $uri -InstallationPolicy Trusted -Credential $cred
Get-PSRepository
}
errorActionPreference: stop
- task: PowerShell@2
displayName: 'Execute build.ps1'
inputs:
targetType: inline
script: |
Set-Location -Path .\DSC
.\Build.ps1 -ResolveDependency -GalleryRepository PowerShell -MofCompilationTaskCount (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
- task: PublishTestResults@2
displayName: 'Publish Integration Test Results'
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/IntegrationTestResults.xml'
failTaskOnFailedTests: true
- task: PublishBuildArtifacts@1
displayName: MOF
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\DSC\BuildOutput\MOF'
ArtifactName: MOF
- task: PublishBuildArtifacts@1
displayName: 'Meta MOF'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\DSC\BuildOutput\MetaMOF'
ArtifactName: 'Meta MOF'
- task: PublishBuildArtifacts@1
displayName: RSOP
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\DSC\BuildOutput\RSOP'
ArtifactName: RSOP
- task: PublishBuildArtifacts@1
displayName: 'Compressed Modules'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\DSC\BuildOutput\CompressedModules'
ArtifactName: 'Compressed Modules'
- task: PublishBuildArtifacts@1
displayName: 'Build Folder'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)'
ArtifactName: 'SourcesDirectory'
- task: PublishTestResults@2
displayName: 'Publish Build Acceptance Test Results'
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/BuildAcceptanceTestResults.xml'
failTaskOnFailedTests: true