Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
) pkg/pipeline built six AWS configs with a bare LoadDefaultConfig. On an instance that names no region, since the SDK reads it from IMDS only when asked, so `spored run-pipeline-stage`'s S3 and EC2 calls would fail with "Missing Region": the same defect #899 fixed in the queue runner. They now share loadAWSConfig, which adds WithEC2IMDSRegion, so an explicit region still wins. Nothing invokes run-pipeline-stage today. The orchestrator's stage user data runs the command itself, and doesn't set the tags the runner needs. So this fix is latent and kept minimal. #910 proposes removing or wiring the runner. Tests: a fake IMDSv2 server checks the helper and NewStageDataHandler's S3 client, and an AST gate fails on any LoadDefaultConfig call in pkg/pipeline outside the helper.
The fake IMDS server writes its identity document through a JSON encoder instead of concatenating it into a raw ResponseWriter write, and the MPI harness runs rank 0's block from a script file rather than bash -c.
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 #906.
What
pkg/pipelinebuilt six AWS configs with a bareLoadDefaultConfig(ctx):NewStageDataHandler,DownloadResultsToLocal,GeneratePeerDiscoveryFile,NewStageRunner,downloadPipelineDefinitionFromS3andIsPipelineInstance. On an EC2 instance nothing ambient names a region, and the SDK reads one from IMDS only when asked. So the S3 and EC2 clients the stage runner builds would fail withMissing Region, the same defect #899/#902 fixed in the queue runner. (NewStageRunnerandIsPipelineInstancealready overwrotecfg.Regionfrom the identity document. The other four did not.)All six now go through one helper,
loadAWSConfiginpkg/pipeline/awsconfig.go:LoadDefaultConfig(ctx, WithEC2IMDSRegion()). IMDS is consulted only when noAWS_REGIONor profile region is set, so an explicit region still wins. Off EC2 with no region configured, the IMDS lookup fails and the config comes back regionless, as before.This is dead code
spored run-pipeline-stageis the only caller of any of these functions, and nothing invokes it:cmd/spored/cli_test.go's subcommand list. None in any sibling repo under spore-host.spawn pipeline launch→spawn-pipeline-orchestratorLambda path writes stage user data that downloads spored but never runs it. It runs the stage command in bash and writes the markers with the AWS CLI.loadStageInfoFromTagsrequiresspawn:s3-config-key, which the orchestrator never sets.So the fix is latent and deliberately minimal. Nothing is deleted. #910 proposes removing the stage runner or wiring it into the orchestrator.
Tests (
pkg/pipeline/awsconfig_test.go)These use a fake IMDSv2 server, as in #902, with every ambient region source cleared:
TestLoadAWSConfig_TakesTheInstanceRegionFromIMDS: the helper resolvesus-west-2from IMDS.TestLoadAWSConfig_AmbientRegionBeatsIMDS:AWS_REGIONstill wins.TestNewStageDataHandler_TakesTheInstanceRegionFromIMDS: checks the region on the S3 client the constructor actually builds.TestEveryPipelineAWSConfigGoesThroughLoadAWSConfig: an AST gate. It fails on any call toLoadDefaultConfigin a non-test pkg/pipeline file outsideloadAWSConfig. It matches the call through whatever alias the config package is imported under, so comments don't count. It fails if discovery finds no call at all.Each gate was run against a revert that compiles (
go vetclean) and failed:WithEC2IMDSRegion: the IMDS test and the data-handler test fail withregion = "".downloadPipelineDefinitionFromS3back toconfig.LoadDefaultConfig: the AST gate fails atstage_runner.go:256.NewStageDataHandlerback toawsconfig.LoadDefaultConfig: the AST gate and the data-handler test both fail.make checkpasses apart from the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nestedpasses (all 9 modules). No public-surface change: pkg/pipeline is not on the surface and the helper is unexported. No AWS resources were created.Related bugs found and filed
data_input/data_outputare validated and appear in every example, but are silently ignored. The orchestrator has only TODOs for them.FAILED, and the instance has nospawn:managedtag, so the TTL reaper cannot see it.