-
Notifications
You must be signed in to change notification settings - Fork 14
/
set-netperf-context.ps1
41 lines (33 loc) · 1.28 KB
/
set-netperf-context.ps1
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
param (
[string]$Matrix,
[string]$GithubRunId,
[string]$SyncerSecret
)
$DeserializedMatrix = ConvertFrom-Json $Matrix
$Boolean = @('TRUE', 'FALSE')
$ValidRoles = @('client', 'server')
if (!($Boolean -contains $DeserializedMatrix.remote_powershell_supported)) {
throw "Invalid remote_powershell_supported value: $($DeserializedMatrix.remote_powershell_supported). Did you forget to run prepare-matrix.ps1?"
exit 1
}
if (!($ValidRoles -contains $DeserializedMatrix.role)) {
throw "Invalid role value: $($DeserializedMatrix.role). Did you forget to run prepare-matrix.ps1?"
exit 1
}
$envstr = $DeserializedMatrix.env_str
if ($envstr.Length -lt 1 -or $GithubRunId.Length -lt 1) {
throw "Invalid env_str inputs and / or run_id"
exit 1
}
Write-Host "Current environment string: $envstr"
if ($DeserializedMatrix.remote_powershell_supported -eq 'TRUE') {
Write-Host "Remote powershell is supported."
$env:netperf_remote_powershell_supported = $true
} else {
Write-Host "Remote powershell is not supported."
$env:netperf_remote_powershell_supported = $false
}
$env:netperf_role = $DeserializedMatrix.role
$env:netperf_run_id = "$GithubRunId-$envstr-state"
$env:netperf_api_url = "https://netperfapi.azurewebsites.net"
$env:netperf_syncer_secret = $SyncerSecret