forked from dsccommunity/CommonTasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines On-Prem.yml
60 lines (50 loc) · 1.96 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
name: $(BuildID)
trigger:
- '*'
pool:
name: Default
workspace:
clean: all
variables:
RepositoryUri: ggggg #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
[Net.ServicePointManager]::SecurityProtocol = [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: filePath
filePath: .\Build.ps1
arguments: -Tasks Init, CleanBuildOutput, SetPsModulePath, CopyModule, IntegrationTest -ResolveDependency -Repository PowerShell
- task: PublishTestResults@2
displayName: 'Publish Integration Test Results'
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/IntegrationTestResults.xml'
failTaskOnFailedTests: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Module'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\BuildOutput\Modules\$(Build.Repository.Name)'
ArtifactName: $(Build.Repository.Name)
ArtifactType: Container
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Build Folder'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)'
ArtifactName: 'SourcesDirectory'