-
Notifications
You must be signed in to change notification settings - Fork 342
Expand file tree
/
Copy pathlive.tests.yml
More file actions
178 lines (158 loc) · 6.34 KB
/
live.tests.yml
File metadata and controls
178 lines (158 loc) · 6.34 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
parameters:
# required matrix parameters
- name: UsePlatformContainer
type: boolean
- name: OSName
type: string
- name: Matrix
type: object
- name: DependsOn
type: string
- name: CloudConfig
type: object
# custom parameters
- name: ServiceDirectory
type: string
- name: TimeoutInMinutes
type: number
# live test parameters
- name: EnvVars
type: object
- name: PreSteps
type: object
- name: PostSteps
type: object
- name: Location
type: string
- name: UseFederatedAuth
type: boolean
- name: PersistOidcToken
type: boolean
jobs:
- job:
displayName: "Test"
condition: and(succeeded(), ne(variables['Skip.Tests'],'true'), ne(${{ parameters.Matrix }}, '{}'))
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
dependsOn: ${{ parameters.DependsOn }}
strategy:
matrix: $[ ${{ parameters.Matrix }} ]
pool:
name: $(Pool)
# 1es pipeline templates converts `image` to demands: ImageOverride under the hood
# which is incompatible with image selection in the default non-1es hosted pools
${{ if eq(parameters.OSName, 'macOS') }}:
vmImage: $(OSVmImage)
${{ else }}:
image: $(OSVmImage)
os: ${{ parameters.OSName }}
variables:
ArmTemplateParameters: '@{}'
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
paths:
- "/*"
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
AgentImage: $(OSVmImage)
- template: /eng/pipelines/templates/steps/use-rust.yml@self
parameters:
Toolchain: $(RustToolchainName)
- template: /eng/pipelines/templates/steps/vcpkg.yml
- ${{ parameters.PreSteps }}
- template: /eng/common/TestResources/build-test-resource-config.yml
parameters:
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
SubscriptionConfigurations: ${{ parameters.CloudConfig.SubscriptionConfigurations }}
SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths }}
EnvVars:
Pool: $(Pool)
${{insert}}: ${{ parameters.EnvVars }}
- template: /eng/common/TestResources/deploy-test-resources.yml
parameters:
${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
ServiceDirectory: ${{ parameters.ServiceDirectory }}
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }}
SubscriptionConfigurationFilePaths: ${{ parameters.CloudConfig.SubscriptionConfigurationFilePaths}}
PersistOidcToken: ${{ parameters.PersistOidcToken }}
EnvVars:
Pool: $(Pool)
${{insert}}: ${{ parameters.EnvVars }}
# To allow tests to run in parallel to Pack, we don't reuse the PackageInfo directory
# from the Pack job. We just let each test leg create its own PackageInfo directory.
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml@self
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
PackageInfoDirectory: $(Build.ArtifactStagingDirectory)/PackageInfo
- pwsh: |
Write-Host "##vso[task.setvariable variable=Logging__LogLevel__Default]Debug"
displayName: 'Enable Verbose Logging'
condition: eq(variables['System.Debug'], 'true')
- ${{ if parameters.UseFederatedAuth }}:
- task: AzurePowerShell@5
displayName: "Test Packages - Federated Auth"
condition: and(succeeded(), eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'))
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
env:
CIBW_BUILD_VERBOSITY: 3
AZURE_TEST_MODE: 'live'
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
${{ if parameters.PersistOidcToken }}:
ARM_OIDC_TOKEN: $(ARM_OIDC_TOKEN)
${{ insert }}: ${{ parameters.EnvVars }}
inputs:
azureSubscription: ${{ parameters.CloudConfig.ServiceConnection }}
azurePowerShellVersion: LatestVersion
pwsh: true
scriptType: inlineScript
inline: |
$account = (Get-AzContext).Account;
$env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id;
$env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants;
Write-Host "./eng/scripts/Test-Packages.ps1 -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo'"
./eng/scripts/Test-Packages.ps1 -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo'
Write-Host "Last exit code: $LASTEXITCODE";
exit $LASTEXITCODE
workingDirectory: $(Build.SourcesDirectory)
- ${{ else }}:
- task: Powershell@2
displayName: "Test Packages"
condition: and(succeeded(), eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'))
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
env:
CIBW_BUILD_VERBOSITY: 3
AZURE_TEST_MODE: 'live'
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
${{ insert }}: ${{ parameters.EnvVars }}
inputs:
pwsh: true
filePath: $(Build.SourcesDirectory)/eng/scripts/Test-Packages.ps1
arguments: >
-PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo'
- task: Powershell@2
displayName: Convert Test Results to JUnit XML
condition: and(succeededOrFailed(), eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'))
inputs:
pwsh: true
filePath: $(Build.SourcesDirectory)/eng/scripts/Convert-TestResultsToJUnit.ps1
- task: PublishTestResults@2
displayName: Publish Test Results
condition: and(succeededOrFailed(), eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'))
inputs:
testResultsFormat: JUnit
testResultsFiles: '**/test-results/junit/*.xml'
testRunTitle: Rust Tests - $(Agent.JobName)
mergeTestResults: true
failTaskOnFailedTests: false
- ${{ parameters.PostSteps }}
- template: /eng/common/TestResources/remove-test-resources.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
SubscriptionConfiguration: $(SubscriptionConfiguration)
UseFederatedAuth: ${{ parameters.UseFederatedAuth }}
ServiceConnection: ${{ parameters.CloudConfig.ServiceConnection }}
EnvVars: ${{ parameters.EnvVars }}