Skip to content

Shard FMA validation workflows and route Windows apps to arch-matched runners#49348

Merged
allenhouchins merged 5 commits into
mainfrom
fma-windows-arch-aware-runners
Jul 15, 2026
Merged

Shard FMA validation workflows and route Windows apps to arch-matched runners#49348
allenhouchins merged 5 commits into
mainfrom
fma-windows-arch-aware-runners

Conversation

@allenhouchins

@allenhouchins allenhouchins commented Jul 15, 2026

Copy link
Copy Markdown
Member

Related issue: N/A — CI improvement for the FMA validation workflows.

Summary

Restructures the Windows and macOS Fleet-maintained app validation workflows around a cheap Linux detect/shard job, with Windows apps additionally routed to a CI runner whose native architecture matches the app's installer.

Both platforms:

  • Change detection and sharding run on ubuntu-latest. Expensive Windows/macOS runners only spin up when their platform actually has changed apps — e.g. a Windows-only letter-batch PR no longer boots a macOS runner just to discover there's nothing to do (and vice versa) — and they check out at depth 1 instead of full history.
  • A new .github/scripts/partition-fma-apps.sh <windows|darwin> emits the job matrix; validation steps move unchanged into reusable workflows (test-fma-windows-validate.yml, test-fma-darwin-validate.yml).
  • Large PRs shard into parallel jobs (Windows: 25 apps/shard, macOS: 30), and the manual full-run workflows gain a shard_size input (Windows default 20 → ~20 shards over 384 apps; macOS default 25 → ~39 shards over 961 apps). Neither full run could previously finish: hundreds of sequential installs blow the 6-hour job limit.
  • Pre-installed app handling is computed per shard from that shard's slug list — Windows removals (Chrome, 7-Zip, Firefox, Node.js, PowerShell, R, Git) and macOS steps (Chrome, Xcode for Icon Composer, the Fleet Desktop MDM config stub) only run on the runner validating that app. This also brings the full-run workflows to parity with the PR gates (they previously only removed Chrome).
  • Stable summary jobs (test-fma-pr-only, test-fma) aggregate the dynamic matrix results so branch protection / PR gating keeps a fixed check name.

Windows arch routing:

  • Each changed <name>/windows slug's installer_arch is read from ee/maintained-apps/inputs/winget/<name>.json: arm64 apps → windows-11-arm, x64/x86/neutral apps → windows-latest (x64). Missing input files default to x64 with a warning. This fixes installers that check the native OS architecture and abort under Prism emulation on the ARM runner (Inno Setup ArchitecturesAllowed=x64 — GOG Galaxy, Reqable — and Docker Desktop). Future arm64 FMAs need no workflow change — installer_arch: arm64 in the winget input is enough.
  • macOS needs no arch matrix: macos-latest is arm64 and x86-only casks run under Rosetta 2, which matches how customer Macs run them.

Checklist for submitter

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.

Testing

  • QA'd all new/changed functionality manually

Manual QA:

  • Partition script is shellcheck-clean and tested against the real repo for both platforms: empty input, mixed-platform slug lists, x86/neutral routing to the x64 runner, single-slug arrays, missing input file fallback, arm64/x64 split with sharding (via a synthetic arm64 input), invalid platform/shard-size rejection, and full-catalog partitions (384 Windows apps → 20 shards, 961 darwin apps → 39 shards, all slugs accounted for, matrix outputs well under the 1 MB job-output limit).
  • All six workflows pass actionlint and zizmor 1.25.2 (with the repo's .github/zizmor-gate.yml config) with no findings.
  • The rewritten Windows PR gate ran on this PR itself: the Linux detect job correctly found no changed Windows apps, skipped the Windows runners, and the test-fma-pr-only summary check passed.

Summary by CodeRabbit

  • New Features
    • Added sharded validation for maintained macOS and Windows apps to run tests in parallel.
    • Added configurable shard_size for manual validation runs.
    • Introduced reusable validation workflows for Darwin and Windows.
    • Improved Windows testing to be architecture-aware (ARM64 vs x64).
  • Bug Fixes
    • Improved pull request gating to validate only changed apps and report results more reliably.
    • Workflows now gracefully handle scenarios where no matching apps are found (avoid unnecessary failures).

… architecture

Partition changed apps by installer_arch (from the winget input JSONs) on a
cheap Linux job, then fan out: arm64 apps validate on windows-11-arm and
x64/x86/neutral apps on the x64 windows-latest runner. Validation steps move
to a reusable workflow shared by the PR gate and the manual full run, with
pre-installed app removal flags computed per shard. Large buckets shard into
parallel jobs, and no Windows runner spins up when a PR changes no Windows
apps.
zizmor flags expanding ${{ inputs.slugs }} directly into run script bodies
as template injection; read it from an env var in both steps instead.
Generalize the partition script to take a platform argument. The darwin
workflows get the same structure as Windows minus arch routing: a Linux
job detects changed apps and shards them, macOS runners only spin up when
darwin apps actually changed, and pre-installed app handling (Chrome,
Xcode/Icon Composer, Fleet Desktop MDM stub) is computed per shard.
@allenhouchins allenhouchins changed the title Route Windows FMA validation to runners matching each app's installer architecture Shard FMA validation workflows and route Windows apps to arch-matched runners Jul 15, 2026
@allenhouchins
allenhouchins marked this pull request as ready for review July 15, 2026 18:31
Copilot AI review requested due to automatic review settings July 15, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures the Fleet-maintained app (FMA) validation GitHub Actions workflows to (1) do cheap change-detection/sharding on Linux and (2) fan out into parallel validation shards on platform-specific runners, including routing Windows apps to native-arch runners based on installer_arch.

Changes:

  • Adds a Linux-based partitioning job that emits a dynamic matrix and only starts expensive Windows/macOS runners when needed.
  • Introduces reusable validation workflows for Windows and Darwin to run per-shard validation consistently across PR-gated and manual full-run workflows.
  • Adds .github/scripts/partition-fma-apps.sh to split apps into shards (and by arch on Windows) and standardizes stable “summary” jobs to keep fixed check names.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/test-fma-windows.yml Manual full Windows run now partitions on Linux and calls a reusable per-shard validation workflow, with a stable summary job.
.github/workflows/test-fma-windows-validate.yml New reusable Windows validation workflow that runs on an arch-matched runner and handles per-shard preinstalled-app cleanup + validation.
.github/workflows/test-fma-windows-pr-only.yml PR-gated Windows workflow now detects/partitions on Linux and fans out validation shards, with a stable summary check.
.github/workflows/test-fma-darwin.yml Manual full macOS run now shards on Linux and calls a reusable per-shard validation workflow, with a stable summary job.
.github/workflows/test-fma-darwin-validate.yml New reusable macOS validation workflow that does per-shard cleanup, filters apps.json, and validates.
.github/workflows/test-fma-darwin-pr-only.yml PR-gated macOS workflow now detects/shards on Linux and fans out validation shards, with a stable summary check.
.github/scripts/partition-fma-apps.sh New partitioner that generates the job matrix, including Windows arch routing + sharding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test-fma-darwin.yml
Comment thread .github/workflows/test-fma-windows-validate.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: efcf37ee-f1c2-4448-abe6-f171282025d1

📥 Commits

Reviewing files that changed from the base of the PR and between 8ba4e1b and d7a909a.

📒 Files selected for processing (1)
  • .github/workflows/test-fma-windows-validate.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test-fma-windows-validate.yml

Walkthrough

The change adds platform-aware FMA sharding with Windows installer-architecture routing. Darwin and Windows workflows detect or enumerate apps, fan out reusable validation workflows across shards, and aggregate results. New reusable workflows prepare runners, remove conflicting preinstalled software, filter apps.json, run the maintained-app validator, and restore the original data.

Possibly related PRs

  • fleetdm/fleet#47598: Updates Windows FMA runner setup and architecture-specific osquery installation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: sharded FMA validation workflows with Windows arch-aware routing.
Description check ✅ Passed The description covers the required summary, checklist, and testing sections, and includes manual QA details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fma-windows-arch-aware-runners

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/partition-fma-apps.sh:
- Around line 115-129: Update the architecture handling around the arch
assignment and case statement to distinguish valid arm64, x64, x86, and neutral
metadata from missing or unsupported values. Emit a warning for missing or
invalid architecture metadata, route only explicitly supported non-arm64 values
to x64, and ensure the summary output reports the effective routing architecture
rather than the raw or empty metadata.

In @.github/workflows/test-fma-windows-validate.yml:
- Around line 107-129: Update each preinstalled-app cleanup step, including
“Remove pre-installed google chrome” and the corresponding blocks, to treat
uninstall failures as fatal. Capture and validate each installer process exit
code, fail on parsing or removal exceptions instead of only logging them, and
verify the specific application is absent after cleanup; throw or exit nonzero
whenever an attempted cleanup does not satisfy that app-specific postcondition.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a682d351-38aa-42ef-b5cd-ef38a7383cbe

📥 Commits

Reviewing files that changed from the base of the PR and between 81ee9a8 and 8ba4e1b.

📒 Files selected for processing (7)
  • .github/scripts/partition-fma-apps.sh
  • .github/workflows/test-fma-darwin-pr-only.yml
  • .github/workflows/test-fma-darwin-validate.yml
  • .github/workflows/test-fma-darwin.yml
  • .github/workflows/test-fma-windows-pr-only.yml
  • .github/workflows/test-fma-windows-validate.yml
  • .github/workflows/test-fma-windows.yml

Comment thread .github/scripts/partition-fma-apps.sh
Comment thread .github/workflows/test-fma-windows-validate.yml
@allenhouchins
allenhouchins merged commit 9b5fc40 into main Jul 15, 2026
16 checks passed
@allenhouchins
allenhouchins deleted the fma-windows-arch-aware-runners branch July 15, 2026 21:07
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.

3 participants