forked from MicrosoftDocs/pipelines-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-pester.yml
132 lines (115 loc) · 4.54 KB
/
azure-pipelines-pester.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
name: TestPester-$(Build.BuildId)
variables:
- group: VariableGroup
- name: global_variable
value: value_global-overwrite_1
- name: directory_include
value: ./include
- name: aVariable
value: 'this is the build id : $(Build.BuildId)'
- template: ${{ variables.directory_include }}/variables.yml
trigger:
- master
jobs:
- job: jobD
pool:
vmImage: 'windows-latest'
variables:
testResultsFile: "$(Agent.WorkFolder)/testresults.xml"
steps:
- task: PowerShell@2
displayName: 'Generate certificate'
inputs:
targetType: inline
script: |
$path = "$(System.DefaultWorkingDirectory)/cert"
mkdir $path -ErrorAction SilentlyContinue
$rand = "$path/rnd"
$private = "$path/private.pem"
$public = "$path/public.pem"
$pfx = "$path/testcert.pfx"
$password = 'DumyPwd'
openssl rand -out $rand 659
Write-Host "*** generate private"
openssl genrsa -aes128 -passout pass:$password -out $private 2048
Write-Host "*** generate public"
openssl req -x509 -new -key $private -subj "/C=BE/ST=Brussels/L=Brussels/O=Belfius Bank/OU=CCoE/CN=belfius.be" -out $public -passin pass:$password -rand $rand
Write-Host "*** generate pfx"
openssl pkcs12 -export -in $public -inkey $private -out $pfx -passout pass:$password -passin pass:$password
Write-Host "*** get info"
openssl pkcs12 -info -in $pfx -passin pass:$password -passout pass:$password
- task: AzurePowerShell@4
displayName: Run Pester...
condition: false
inputs:
azurePowerShellVersion: LatestVersion
azureSubscription: "rg-playground-carth-service-connection"
ScriptType: InlineScript
Inline: |
$PSVersionTable
Install-Module -Name Pester -Force -ErrorAction Stop
$PesterSettings = @{
Script = @{
Path = "$(System.DefaultWorkingDirectory)/tests/pester.tests.ps1"
Parameters = @{
parameter1 = 'value of parameter1'
parameter2 = 'value of parameter2'
}
}
OutputFile = "$(testResultsFile)"
OutputFormat = "NUnitXml"
EnableExit = $true
Verbose = $true
}
Invoke-Pester @PesterSettings
- task: PublishTestResults@2
displayName: Publish Pester tests results
condition: false
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '$(testResultsFile)'
- task: AzureCLI@2
displayName: Show info
inputs:
azureSubscription: 'rg-playground-carth-service-connection'
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
$PSVersionTable
az --version
- script: echo $(System.AccessToken) | az devops login
env:
AZURE_DEVOPS_CLI_PAT: $(System.AccessToken)
displayName: 'Login Azure DevOps Extension'
- task: AzurePowerShell@5
displayName: Download artificats AzurePowerShell
env:
AZURE_DEVOPS_CLI_PAT: $(System.AccessToken)
inputs:
azureSubscription: 'rg-playground-carth-service-connection'
ScriptType: 'InlineScript'
Inline: |
az artifacts universal download --organization https://dev.azure.com/thierrycarels0265/ `
--project="pipeline-playground" `
--scope project `
--feed publish-feed `
--name pipelines-java-package `
--version 0.0.10 `
--path .
azurePowerShellVersion: 'LatestVersion'
- task: AzureCLI@2
displayName: Download artificats AzureCLI
env:
AZURE_DEVOPS_CLI_PAT: $(System.AccessToken)
inputs:
azureSubscription: 'rg-playground-carth-service-connection'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az artifacts universal download --organization https://dev.azure.com/thierrycarels0265/ `
--project="pipeline-playground" `
--scope project `
--feed publish-feed `
--name pipelines-java-package `
--version 0.0.10 `
--path .