Skip to content

Add Windows CLI starter validation#15455

Open
sebastienros wants to merge 6 commits intomainfrom
sebros/cli-startup-check-main
Open

Add Windows CLI starter validation#15455
sebastienros wants to merge 6 commits intomainfrom
sebros/cli-startup-check-main

Conversation

@sebastienros
Copy link
Contributor

Description

Adds a new Windows PR CI validation for the Aspire CLI in tests.yml on main. The workflow dogfoods the CLI built by the current PR run, creates the starter templates, runs aspire start, trusts HTTPS development certificates up front, and verifies the expected resources come up with aspire wait.

This mirrors the release/13.2 change, but it is adapted to the current main workflow shape and keeps the PR-only job filtered to the microsoft org.

Validation:

  • Parsed .github/workflows/tests.yml successfully with Ruby YAML parsing.
  • Verified the workflow wiring on top of the current main branch layout.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 20, 2026 23:07
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15455

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15455"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Windows-only PR validation job to dogfood the Aspire CLI built in the same workflow run by creating starter templates, running aspire start, and verifying resources become ready via aspire wait.

Changes:

  • Introduces cli_starter_validation_win job to install the PR-built Aspire CLI, trust dev certs, and smoke test starter templates on Windows.
  • Captures and uploads diagnostics/logs as workflow artifacts for debugging failures.
  • Wires the new job into the workflow’s aggregate/required job dependencies and skip-logic for PRs.

Comment on lines +300 to +303
$startOutput = @(
if (Test-Path $startStdOutPath) { Get-Content $startStdOutPath }
if (Test-Path $startStdErrPath) { Get-Content $startStdErrPath }
) -join [Environment]::NewLine
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get-Content without -Raw returns an array of lines; when combined via the outer @(...) and -join, PowerShell may stringify arrays using its default separator (spaces), which can drop original newlines and make logs/regex checks less reliable. Prefer reading stdout/stderr with Get-Content -Raw (and then concatenating with a single newline between them) so the combined log preserves exact output formatting.

Suggested change
$startOutput = @(
if (Test-Path $startStdOutPath) { Get-Content $startStdOutPath }
if (Test-Path $startStdErrPath) { Get-Content $startStdErrPath }
) -join [Environment]::NewLine
$startStdOut = if (Test-Path $startStdOutPath) { Get-Content -Raw $startStdOutPath } else { '' }
$startStdErr = if (Test-Path $startStdErrPath) { Get-Content -Raw $startStdErrPath } else { '' }
$startOutput = ($startStdOut, $startStdErr) -join [Environment]::NewLine

Copilot uses AI. Check for mistakes.
Comment on lines +289 to +299
$process | Wait-Process -Timeout ([int]$env:MAX_STARTUP_SECONDS) -ErrorAction Stop
}
catch {
if (-not $process.HasExited) {
$process | Stop-Process -Force -ErrorAction SilentlyContinue
}

throw "${templateId}: aspire start did not exit within $($env:MAX_STARTUP_SECONDS) seconds."
}

$elapsed = (Get-Date) - $startAt
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be flaky at the boundary: Wait-Process -Timeout may return successfully when the process exits near the timeout, but the separately computed $elapsed can still be >= MAX_STARTUP_SECONDS due to scheduling/measurement overhead, causing an unexpected failure. To avoid false negatives, either remove the elapsed check (since timeout already enforces it) or change it to a strictly-greater check with a small buffer (e.g., allow a couple seconds over) to account for timing granularity.

Copilot uses AI. Check for mistakes.
throw "${templateId}: aspire start failed with exit code $($process.ExitCode)."
}

if ($elapsed.TotalSeconds -ge [int]$env:MAX_STARTUP_SECONDS) {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be flaky at the boundary: Wait-Process -Timeout may return successfully when the process exits near the timeout, but the separately computed $elapsed can still be >= MAX_STARTUP_SECONDS due to scheduling/measurement overhead, causing an unexpected failure. To avoid false negatives, either remove the elapsed check (since timeout already enforces it) or change it to a strictly-greater check with a small buffer (e.g., allow a couple seconds over) to account for timing granularity.

Suggested change
if ($elapsed.TotalSeconds -ge [int]$env:MAX_STARTUP_SECONDS) {
$maxStartupSeconds = [int]$env:MAX_STARTUP_SECONDS
$timingBufferSeconds = 2
if ($elapsed.TotalSeconds -gt ($maxStartupSeconds + $timingBufferSeconds)) {

Copilot uses AI. Check for mistakes.
Comment on lines +235 to +240
- name: Create starter app and validate startup
timeout-minutes: 10
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow embeds a large multi-template PowerShell harness inline, which makes the YAML hard to review/maintain and harder to run locally for debugging. Consider moving the validation logic into a tracked script (e.g., eng/scripts/cli-starter-validation.ps1) and have the workflow call it with parameters (timeouts, templates, expected resources). This keeps the workflow concise, enables reuse, and centralizes changes for future template/resource updates.

Copilot uses AI. Check for mistakes.
@sebastienros sebastienros requested a review from eerhardt March 21, 2026 02:36
@github-actions
Copy link
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit ff5666f)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23370216804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants