forked from dsccommunity/DscWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines On-Prem.yml
91 lines (79 loc) · 3.16 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:
- '*'
variables:
RepositoryUri: ggggg #will be replaced during lab deployment
jobs:
- job: DscBuild
strategy:
parallel: 1
pool:
name: Default
workspace:
clean: all
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 = '$(RepositoryUri)'
$name = 'PowerShell'
$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
Get-PSRepository
}
errorActionPreference: stop
- task: PowerShell@2
displayName: 'Execute build.ps1'
inputs:
targetType: inline
script: |
Set-Location -Path .\DSC
[int]$currentJobNumber = $env:SYSTEM_JOBPOSITIONINPHASE
[int]$totalJobCount = $env:SYSTEM_TOTALJOBSINPHASE
Write-Host "Calling 'Build.ps1' with parameter 'CurrentJobNumber' = $currentJobNumber and 'TotalJobCount' = $totalJobCount"
.\Build.ps1 -ResolveDependency -Repository PowerShell -CurrentJobNumber $currentJobNumber -TotalJobCount $totalJobCount
- 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
condition: and(succeeded(), not(startsWith(variables['BHCommitMessage'], '--Added new node')))
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