Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
--command, --user-data and --user-data-file were accepted for a Windows launch and dropped: buildWindowsUserData takes only the SSH key, and nothing on Windows reads the spawn:command tag. The workload never ran, --on-complete never fired, and the instance billed until its TTL. Every launch flag now has a recorded Windows disposition in windowsLaunchFlags: honoured, or refused with a reason. The guard runs at the top of runLaunch for an explicit --os windows (covering the batch-queue and detached-sweep dispatches, which never resolve an OS) and inside windowsLifecycleGuard, where an auto-detected Windows AMI is first known (single, array, foreground sweep and --dry-run). buildUserData refuses a Windows command or custom user data as a backstop. Refused besides the issue's three: --plugin/--config, --session-timeout, --params/--param-file, --batch-queue/--queue-template, --strata-*, --mpi and its options, --efs-*, --attach-volume and --fsx-* (each was dropped on the Windows path; --fsx-create created a billed filesystem nothing mounted).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1022
What
--command,--user-dataand--user-data-filewere accepted for a Windows launch and then dropped.buildWindowsUserDatatakes only the SSH key, and nothing on Windows reads thespawn:commandtag. The workload never ran,--on-completenever fired, and the instance billed until its TTL.I chose refuse over implement. I can't run PowerShell here (no
pwsh), so a PowerShell--commandrunner could only be string-tested. The issue also asks that a Windows workload start be gated onspored is-spot-replacement, which exists only in #1021, and has no Windows counterpart even there. Implementing it can come later, as a feature. Silently dropping the flag was the bug.cmd/launch_windows_flags.go:windowsLaunchFlagsrecords a decision for everyspawn launchflag, local and inherited: honoured on Windows, or refused with a reason.windowsUnsupportedFlagsrefuses a Windows launch that sets any refused flag, and names them all in one error.runLaunch, for an explicit--os windows, before any AWS call. This is the only check the batch-queue and detached-sweep dispatches get, because they never resolve an OS.windowsLifecycleGuard, where an auto-detected Windows AMI is first known. That covers a single launch, job arrays, foreground sweeps and--dry-run.buildUserDatarefuses a Windows command or custom user data at the point where they would be dropped.Refused on Windows, each dropped on the Windows path today:
--command,--user-dataand--user-data-file.--pluginand--config:plugins.jsonis written only by the Linux bootstrap.--session-timeout: aprofile.dscript.--paramsand--param-file: per-row commands andPARAM_*values travel in tags that only the Linux bootstrap reads.--batch-queueand--queue-template: bash runner.--strata-*: al2023 environments.--mpiand its options.--efs-*,--attach-volumeand--fsx-*. The storage script is skipped for Windows, so an attached volume is never mounted, and--fsx-createcreated and billed a Lustre filesystem that nothing could mount.Honoured: EC2 parameters, IAM, CLI-side behaviour, and the lifecycle tags spored enforces as a Windows service: TTL, idle, on-complete, completion file, pre-stop via PowerShell, webhooks, DNS and cost limit. Each entry carries its reason.
Tests (
cmd/launch_windows_flags_test.go)TestEveryLaunchFlagHasAWindowsRulediscovers the flags from the cobra command,Flags()andInheritedFlags(). It fails on a flag with no entry, on an entry with no reason, on a stale entry, and on a discovery of fewer than 50 flags.TestWindowsFlagRulesAreEnforcedmarks each discovered flag set, one at a time, on a copy of the flag set, so no globals are mutated. Refused flags must be refused and named, honoured ones accepted, and Linux is never refused.TestWindowsRefusesCommandAndUserDatanames the issue's flags plus the confirmed drops (plugin, fsx-create, efs-id, attach-volume, mpi, params, batch-queue) outright. The table-driven test reads the same table as the guard, so on its own it cannot catch one of them being reclassified as honoured.TestWindowsDryRunRefusesCommandgoes throughrunLaunchDryRunon Substrate and asserts the refusal and that no plan is printed. Linux is unaffected.TestRunLaunchRefusesWindowsSweepBeforeDispatchchecks thatrunLaunchwith--os windows --paramsis refused before the sweep dispatch.TestBuildUserDataRefusesWindowsWorkloadcovers the backstop.TestWindowsGuardIgnoresDefaultschecks that defaulted flags, such as--session-timeout(default 30m) and--efs-mount-point, don't refuse a plain Windows launch.I watched each test fail against a revert that compiles (
go vetclean):windowsLifecycleGuardrunLaunchcall madefalse && err != nilif falseChecks
make check(credentials stripped): the only failure is the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: 9 modules clean.golangci-lint --new-from-rev=origin/main ./cmd/...: 0 issues.Caveats
--os windows. With an auto-detected Windows AMI they still don't resolve an OS. That is a pre-existing gap, not widened here.--attach-volume: Windows may see the raw disk, but the flag's contract (a mount point) can't be met, so it is refused.