fix(burn-in): add -SkipArtifact switch; restore production fail-on-missing-dist

PROBLEM: Invoke-RemoteBuild.ps1 was creating a placeholder artifact when the build
produced no dist/ directory. In production this hides build defects (build exits 0
but produces nothing = silent failure treated as success).

SOLUTION: Add explicit -SkipArtifact switch to the call chain:

Invoke-RemoteBuild.ps1:
  - Add -SkipArtifact switch. When set: skips packaging entirely (no zip created).
  - When absent (production default): missing GuestArtifactSource is a hard error
    with a clear message pointing to -SkipArtifact as the opt-in for no-output builds.

Invoke-CIJob.ps1:
  - Add -SkipArtifact switch. Passes it to Invoke-RemoteBuild.ps1.
  - Phase 6 (Get-BuildArtifacts) is entirely skipped when set; logs 'skipped' event.

Test-CapacityBurnIn.ps1:
  - Add -SkipArtifact switch. Adds '-SkipArtifact' flag to each child job argList.

Start-BurnInTest.ps1:
  - Always passes -SkipArtifact by default (burn-in uses delay commands, no output).
  - Add -NoSkipArtifact override switch for runs that do produce real artifacts.
  - Remove -NoSkipArtifact escape from wrapper: default burn-in never needs artifacts.
This commit is contained in:
Simone
2026-05-12 21:28:11 +02:00
parent e0b45fc71d
commit 80eeb389af
4 changed files with 55 additions and 33 deletions
+30 -20
View File
@@ -105,6 +105,11 @@ param(
# Requires Set-TemplateSharedFolders.ps1 to have been run on the template.
[switch] $UseSharedCache,
# Skip artifact packaging and collection (Phase 5 packaging + Phase 6).
# Use for burn-in / smoke builds that intentionally produce no output.
# In production (absent) the build must produce artifacts or the job fails.
[switch] $SkipArtifact,
# Credential Manager target for Gitea PAT used by -UseGitClone (private repos).
# Store with: New-StoredCredential -Target 'GiteaPAT' -UserName '<user>' -Password '<pat>' -Persist LocalMachine
# Ignored when -UseGitClone is not set.
@@ -494,35 +499,40 @@ try {
if ($GuestArtifactSource -ne '') { $remoteBuildParams['GuestArtifactSource'] = $GuestArtifactSource }
if ($ExtraGuestEnv.Count -gt 0) { $remoteBuildParams['ExtraGuestEnv'] = $ExtraGuestEnv }
if ($UseSharedCache) { $remoteBuildParams['UseSharedCache'] = $true }
if ($SkipArtifact) { $remoteBuildParams['SkipArtifact'] = $true }
& "$scriptDir\Invoke-RemoteBuild.ps1" @remoteBuildParams
Write-JobEvent -Phase 'phase5.build' -Status 'success'
$phaseTimings.Add([PSCustomObject]@{ Phase = 'Phase 5 - Remote build'; Sec = [int]((Get-Date) - $phaseStart).TotalSeconds })
$phaseStart = Get-Date
# ── Phase 6: Collect artifacts ────────────────────────────────────────
Write-Host "`n[Phase 6/6] Collecting artifacts..."
Write-JobEvent -Phase 'phase6.artifacts' -Status 'start'
if ($GuestOS -eq 'Linux') {
& "$scriptDir\Get-BuildArtifacts.ps1" `
-IPAddress $VMIPAddress `
-GuestOS 'Linux' `
-SshKeyPath $SshKeyPath `
-SshUser $SshUser `
-SshKnownHostsFile $SshKnownHostsFile `
-GuestArtifactPath '/opt/ci/output' `
-HostArtifactDir $jobArtifactDir `
-IncludeLogs
if ($SkipArtifact) {
Write-Host "`n[Phase 6/6] Artifact collection skipped (-SkipArtifact)."
Write-JobEvent -Phase 'phase6.artifacts' -Status 'skipped'
} else {
& "$scriptDir\Get-BuildArtifacts.ps1" `
-IPAddress $VMIPAddress `
-Credential $credential `
-GuestArtifactPath 'C:\CI\output\artifacts.zip' `
-HostArtifactDir $jobArtifactDir `
-IncludeLogs
Write-Host "`n[Phase 6/6] Collecting artifacts..."
Write-JobEvent -Phase 'phase6.artifacts' -Status 'start'
if ($GuestOS -eq 'Linux') {
& "$scriptDir\Get-BuildArtifacts.ps1" `
-IPAddress $VMIPAddress `
-GuestOS 'Linux' `
-SshKeyPath $SshKeyPath `
-SshUser $SshUser `
-SshKnownHostsFile $SshKnownHostsFile `
-GuestArtifactPath '/opt/ci/output' `
-HostArtifactDir $jobArtifactDir `
-IncludeLogs
} else {
& "$scriptDir\Get-BuildArtifacts.ps1" `
-IPAddress $VMIPAddress `
-Credential $credential `
-GuestArtifactPath 'C:\CI\output\artifacts.zip' `
-HostArtifactDir $jobArtifactDir `
-IncludeLogs
}
Write-JobEvent -Phase 'phase6.artifacts' -Status 'success' -Data @{ dir = $jobArtifactDir }
}
$elapsed = (Get-Date) - $startTime
Write-JobEvent -Phase 'phase6.artifacts' -Status 'success' -Data @{ dir = $jobArtifactDir }
Write-JobEvent -Phase 'job' -Status 'success' -Data @{ elapsedSec = [int]$elapsed.TotalSeconds }
$phaseTimings.Add([PSCustomObject]@{ Phase = 'Phase 6 - Artifacts'; Sec = [int]((Get-Date) - $phaseStart).TotalSeconds })
Write-Host "`n============================================================"