Repository navigation
fix(sweep): give detached members their tags, passable profiles and row user_data (#1330, #1331, #1327) - #1354
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ow user_data (#1330, #1331, #1327) - #1330: the CLI renders each detached member's instance tags with the code a foreground launch uses (aws.LaunchTagger, now shared with Client.Launch), after the foreground's per-member defaults (defaultSweepMember, incl. the 1h idle default), and ships them as spawn_tags. The orchestrator tags the instance and its volumes with them, re-anchored at the real launch (aws.AnchorLaunchTags), sets the sweep identity and spawn:managed itself, and refuses a member without them. A Spot member that would need a persistent request is refused up front. - #1331: the cross-account role may also pass role/spawn-instance-* to EC2; the CLI refuses any other profile on a detached sweep or schedule before creating anything. - #1327: a sweep row's user_data: runs after spored's bootstrap and --user-data on the foreground, detached and resume paths. Fixes #1330 Fixes #1331 Fixes #1327
scttfrdmn
force-pushed
the
fix/1330-1331-1327-detached-sweeps
branch
from
October 27, 2026 02:47
0edbf9b to
76836e0
Compare
scttfrdmn
added a commit
that referenced
this pull request
Oct 27, 2026
….0-era params (#1368) (#1370) A CLI at v0.146.0 or older uploads only ami, iam_role, instance_type, key_name, spot and ttl per member, and existing schedules replay those params on every firing, so neither carries spawn_user_data or spawn_tags. Since #1332/#1354 the orchestrator refused such members. It now renders both itself with the shared builders (launcher.BuildUserData, whose stub fetches the body published for the orchestrator's own release, and aws.BuildLaunchTags), so those members run spored and carry the full tag set. Strict params are unchanged; params carrying only one key are refused. The deploy script now deploys only a clean release tag whose published bootstrap body matches the compiled one, injects -X main.Version, and builds the package instead of main.go alone, which no longer compiled.
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 #1330
Fixes #1331
Fixes #1327
#1330: detached members get the foreground member's tags
pkg/aws: newLaunchTagger(Client.NewLaunchTagger,Tags,TagValues).Client.Launchnow builds its tags through it as well, so there is one builder: caller identity, account name, truffle price, thenbuildTags(exported asBuildLaunchTags). The tagger prices each (region, type, OS) once per sweep. A missing price is reused only for a member with no cost limit, so a member that has a cost limit is still refused.pkg/aws.AnchorLaunchTagsre-anchors the launch instants (spawn:launch-time,spawn:ttl-deadlinefromspawn:ttl, a persistent Spotspawn:spot-valid-until,spawn:job-array-created) at the real launch. An unparseablespawn:ttlis an error, never a member without a deadline.buildTagstakes its instant from atagClockvar so the gate can render at two instants.seedDetachedBootstrap, used byspawn launch --param-fileandspawn schedule create): each member is built withdefaultSweepMember, which is now shared with the foreground loop (region/type fallback,<sweep>-<i>name, and the 1h idle default for a member with no ttl/idle_timeout). Its tags are rendered and shipped per row asspawn_tags(a reserved row key). A Spot member that would need a persistent request is refused. See the follow-up below.now.spawn:sweep-id,spawn:sweep-name,spawn:sweep-indexandspawn:managed=trueare set by the Lambda. A member withoutspawn_tagsis refused, as a member without user data already is.sweepRowLifecycleTagsis gone, and the Lambda no longer reads thettlparam.embeddedCommand). The gate checks that one is in the user data and not in a tag.#1331: PassRole for spawn-created profiles; refuse the rest
scripts/setup-sweep-cross-account-role.sh:iam:PassRolenow also coversarn:aws:iam::${ACCOUNT}:role/spawn-instance-*, still conditioned oniam:PassedToService=ec2.amazonaws.com. The pipeline orchestrator already has this grant.--instance-profile NAME,--iam-role NAME, and adefaults:/rowiam_role:naming anything other thanspored-instance-profile,spawnd-roleorspawn-instance-*are refused beforeapplyCLIIAMToSweepcreates anything (on the launch path and inspawn schedule create). The message points at--iam-policy(without--iam-role) or--no-detach. I chose refusal over a broader grant because a PassRole wide enough for arbitrary roles would let the orchestrator hand any role in the account, admin included, to an instance.#1327: row
user_data:runsLaunchConfig.CustomUserData.buildLaunchConfigFromParamsstores the row's value there, not inUserData, which the foreground loop overwrote.buildUserDataForKeyappends it after--user-dataon the foreground, detached and resume paths. A Windows member with one is refused.Gates, each watched failing against a compiling revert
TestDetachedMemberTagsAreTheForegroundMembers,TestEveryDetachedMemberIsBounded,TestDetachedSpotMemberThatWouldStopIsRefused,TestSeedScheduleParams_CarriesTheTagspf.Params[i][detachedTagsKey] = …→_ = memberTags[i]defaultSweepMember(...)→falsein the seedTestDetachedSpotMemberThatWouldStopIsRefusedTestAnchorLaunchTagsMovesEveryInstant(the time-dependent set is discovered by rendering at two instants)TestLaunchTaggerPricesEachShapeOnceTestMemberLaunchesWithTheCLIsTags,TestMemberTTLCountsFromTheRealLaunch,TestSweepRowIsReapableTestSweepRowUserDataRunsconfig.CustomUserData = s→config.UserData = s; join droppedTestDetachedPassableProfilesMatchTheGrant(reads the script's grant) + scriptsTestSweepCrossAccountRoleMayPassSporedsRolespawn-instance-*removed from the script; prefix check brokenTestUnpassableDetachedProfileIsRefusedUpFront--instance-profilecheck removed; refusal call disabled (&& false,if false) on the launch path or in scheduleChecks
make check: every stage passes exceptcheck-build-tags, which fails the same way on unmodified main from a/private/tmpworktree.make lintreports 0 issues in all 10 modules. Also run:make check-docs,semgrep scan --config=auto --error .,make api-snapshot(additions only:LaunchTagger,NewLaunchTagger,AnchorLaunchTags,BuildLaunchTags,LaunchConfig.CustomUserData), and the lambda/sweep-orchestrator and scripts module tests.Deploy (not done here)
spawn_tagsare ignored by the old Lambda, and the old behaviour continues. After the redeploy, sweeps and schedules created by an older CLI are refused per member (nospawn_tags) and must be re-created.scripts/setup-sweep-cross-account-role.shin each member account (SPAWN_MEMBER_ACCOUNT=…), then do one real PutRolePolicy and simulate allow/deny before relying on it.Follow-up: #1353. Detached members still drop every non-tag RunInstances setting (volume_size, SGs/subnet/AZ, spot_max_price, hibernation, EFA, placement, persistent Spot).