mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-20 06:00:06 +08:00
* ci(windows): exercise MXC provider credential example Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> * ci(windows): exercise MXC OCSF audit example Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> * ci(windows): enable aggregate MXC example E2E Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> * ci(windows): select native MXC mock target Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> * fix(windows): isolate MXC example CI harnesses Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> --------- Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
77 lines
2.3 KiB
PowerShell
77 lines
2.3 KiB
PowerShell
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
function Push-OpenShellMxcE2eEnvironment {
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $StageDir
|
|
)
|
|
|
|
$isolatedValues = [ordered]@{
|
|
APPDATA = Join-Path $StageDir "appdata"
|
|
LOCALAPPDATA = Join-Path $StageDir "localappdata"
|
|
XDG_CONFIG_HOME = Join-Path $StageDir "xdg-config"
|
|
XDG_STATE_HOME = Join-Path $StageDir "xdg-state"
|
|
XDG_DATA_HOME = Join-Path $StageDir "xdg-data"
|
|
OPENSHELL_GATEWAY = $null
|
|
OPENSHELL_GATEWAY_ENDPOINT = $null
|
|
OPENSHELL_GATEWAY_INSECURE = $null
|
|
OPENSHELL_GATEWAY_CONFIG = $null
|
|
OPENSHELL_GATEWAY_NAME = $null
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path @(
|
|
$isolatedValues.APPDATA
|
|
$isolatedValues.LOCALAPPDATA
|
|
$isolatedValues.XDG_CONFIG_HOME
|
|
$isolatedValues.XDG_STATE_HOME
|
|
$isolatedValues.XDG_DATA_HOME
|
|
) | Out-Null
|
|
|
|
$savedValues = @{}
|
|
foreach ($name in $isolatedValues.Keys) {
|
|
$savedValues[$name] = [System.Environment]::GetEnvironmentVariable(
|
|
$name,
|
|
[System.EnvironmentVariableTarget]::Process
|
|
)
|
|
}
|
|
|
|
try {
|
|
foreach ($entry in $isolatedValues.GetEnumerator()) {
|
|
[System.Environment]::SetEnvironmentVariable(
|
|
$entry.Key,
|
|
$entry.Value,
|
|
[System.EnvironmentVariableTarget]::Process
|
|
)
|
|
}
|
|
} catch {
|
|
foreach ($entry in $savedValues.GetEnumerator()) {
|
|
[System.Environment]::SetEnvironmentVariable(
|
|
$entry.Key,
|
|
$entry.Value,
|
|
[System.EnvironmentVariableTarget]::Process
|
|
)
|
|
}
|
|
throw
|
|
}
|
|
|
|
return [pscustomobject]@{ Values = $savedValues }
|
|
}
|
|
|
|
function Pop-OpenShellMxcE2eEnvironment {
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[psobject] $Snapshot
|
|
)
|
|
|
|
foreach ($entry in $Snapshot.Values.GetEnumerator()) {
|
|
[System.Environment]::SetEnvironmentVariable(
|
|
$entry.Key,
|
|
$entry.Value,
|
|
[System.EnvironmentVariableTarget]::Process
|
|
)
|
|
}
|
|
}
|