feat(launcher): complete Campaign LA11 pre-gate support
This commit is contained in:
parent
f881e5b467
commit
134edabed2
19 changed files with 433 additions and 55 deletions
|
|
@ -68,16 +68,22 @@ $startedUtc = [DateTime]::UtcNow
|
|||
function Protect-Text([string]$Text) {
|
||||
if ($null -eq $Text) { return '' }
|
||||
$protected = $Text
|
||||
foreach ($name in @('ACDREAM_TEST_PASS', 'ACDREAM_LA_GATE_SECRET')) {
|
||||
$value = [Environment]::GetEnvironmentVariable($name)
|
||||
if (-not [string]::IsNullOrEmpty($value)) {
|
||||
$protected = $protected.Replace($value, '<redacted>', [StringComparison]::Ordinal)
|
||||
}
|
||||
}
|
||||
$protected = [Text.RegularExpressions.Regex]::Replace(
|
||||
$protected,
|
||||
'(?i)(--password|-password)(\s+|=)([^\s"'']+)',
|
||||
'$1$2<redacted>')
|
||||
$protected = [Text.RegularExpressions.Regex]::Replace(
|
||||
$protected,
|
||||
'(?i)\b(password|passwd|secret|token|credential|api[_-]?key)(\s*[:=]\s*)([^\s,;]+)',
|
||||
'$1$2<redacted>')
|
||||
$protected = [Text.RegularExpressions.Regex]::Replace(
|
||||
$protected,
|
||||
'(?i)(https?://)[^/\s:@]+:[^@\s/]+@',
|
||||
'$1<redacted>@')
|
||||
$protected = [Text.RegularExpressions.Regex]::Replace(
|
||||
$protected,
|
||||
'(?i)([?&](?:token|secret|password|credential|api[_-]?key)=)[^&\s]+',
|
||||
'$1<redacted>')
|
||||
$protected = [Text.RegularExpressions.Regex]::Replace(
|
||||
$protected,
|
||||
'(?i)("(?:password|credential|secret|token)"\s*:\s*")[^"]*(")',
|
||||
|
|
@ -142,6 +148,11 @@ function Invoke-GateCommand(
|
|||
$startInfo.RedirectStandardOutput = $true
|
||||
$startInfo.RedirectStandardError = $true
|
||||
foreach ($argument in $Arguments) { $startInfo.ArgumentList.Add($argument) }
|
||||
foreach ($key in @($startInfo.Environment.Keys)) {
|
||||
if ($key.StartsWith('ACDREAM_', [StringComparison]::OrdinalIgnoreCase)) {
|
||||
$startInfo.Environment.Remove($key)
|
||||
}
|
||||
}
|
||||
foreach ($entry in $Environment.GetEnumerator()) {
|
||||
$startInfo.Environment[[string]$entry.Key] = [string]$entry.Value
|
||||
}
|
||||
|
|
@ -258,6 +269,34 @@ try {
|
|||
'--', 'RunConfiguration.MaxCpuCount=1')
|
||||
}
|
||||
|
||||
$headlessValidationConfig = Join-Path $OutputDirectory 'headless-k0.json'
|
||||
Add-InternalCheck 'portable-headless-write-empty-config' {
|
||||
[IO.File]::WriteAllText(
|
||||
$headlessValidationConfig,
|
||||
'{"version":1,"sessions":[]}',
|
||||
[Text.UTF8Encoding]::new($false))
|
||||
}
|
||||
Invoke-DotNet 'portable-headless-help-no-connect' @(
|
||||
'run', '--project', 'src/AcDream.Headless/AcDream.Headless.csproj',
|
||||
'-c', 'Release', '--no-build', '--', '--help')
|
||||
Invoke-DotNet 'portable-headless-validate-empty-no-connect' @(
|
||||
'run', '--project', 'src/AcDream.Headless/AcDream.Headless.csproj',
|
||||
'-c', 'Release', '--no-build', '--',
|
||||
'validate', '--config', $headlessValidationConfig)
|
||||
Add-InternalCheck 'portable-headless-native-permission' {
|
||||
if (-not $IsWindows) {
|
||||
$headlessExecutable = Join-Path `
|
||||
$Repository 'src/AcDream.Headless/bin/Release/net10.0/acdream-headless'
|
||||
if (-not (Test-Path -LiteralPath $headlessExecutable -PathType Leaf)) {
|
||||
throw 'The native Headless build output is missing.'
|
||||
}
|
||||
$mode = [IO.File]::GetUnixFileMode($headlessExecutable)
|
||||
if (($mode -band [IO.UnixFileMode]::UserExecute) -eq 0) {
|
||||
throw 'The native Headless build output is not executable.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rid in @('win-x64', 'linux-x64')) {
|
||||
$destination = Join-Path $publishDirectory $rid
|
||||
Invoke-DotNet "publish-launcher-$rid" @(
|
||||
|
|
@ -382,7 +421,8 @@ finally {
|
|||
failures = @($failures)
|
||||
redaction = [ordered]@{
|
||||
applied = $true
|
||||
environmentValuesNeverReported = @('ACDREAM_TEST_PASS', 'ACDREAM_LA_GATE_SECRET')
|
||||
inheritedAcdreamEnvironmentCleared = $true
|
||||
inheritedEnvironmentValuesRead = $false
|
||||
credentialArgumentsAllowed = $false
|
||||
}
|
||||
artifacts = $artifacts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue