Pin AWS SDK code generation to the versions in go.mod - #8795
Merged
Conversation
generate-aws-interfaces.sh ran `go get` for each AWS service before invoking ifacemaker. `go get` resolves to the module's latest release and rewrites go.mod, and because `go generate ./pkg/awsapi/...` runs from generate-always, this happened on every build. The effect is that builds are not reproducible and the pinned versions in go.mod are ignored during code generation. Interfaces are generated against whatever AWS published most recently, so an upstream release can change generated code and break tests with no corresponding commit here. This is not theoretical. AWS published service/eks v1.91.0, which adds KubeApiServerConfig, KubeControllerManagerConfig and KubeSchedulerConfig to ekstypes.Cluster. go.mod pins v1.88.0, but builds resolved v1.91.0, so the four pkg/printers golden-file specs that serialize an EKS Cluster started failing on every pull request, including one that changed only a markdown file. The same run also upgraded ssm 1.68.6 -> 1.73.5, iam 1.58.1 -> 1.58.2 and elasticloadbalancingv2 1.58.5 -> 1.58.6. Use `go mod download` instead, which fetches the version already selected in go.mod without modifying it. All eleven services generated by pkg/awsapi/generate are direct requirements, so each resolves to its pinned version. Upgrading an SDK is now an explicit commit, which is what Dependabot is already for.
Contributor
|
Hello gustavodiaz7722 👋 Thank you for opening a Pull Request in |
naclonts
approved these changes
Aug 11, 2026
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.
Problem
build/scripts/generate-aws-interfaces.shrango getfor each AWS servicebefore invoking
ifacemaker.go getresolves to the module's latestrelease and rewrites
go.mod. Becausego generate ./pkg/awsapi/...is part ofgenerate-always, this ran on every build.So the pinned versions in
go.modwere ignored during code generation, buildswere not reproducible, and an upstream AWS release could change generated code
or break tests with no corresponding commit in this repository.
This is currently breaking CI on every pull request
AWS published
service/eksv1.91.0, which addsKubeApiServerConfig,KubeControllerManagerConfigandKubeSchedulerConfigtoekstypes.Cluster.go.modpins v1.88.0, but builds resolved v1.91.0:The four
pkg/printersgolden-file specs serialize an EKSCluster, and thegolden files (last updated 2026-06-22) do not contain those fields, so they now
fail on every PR. Evidence that this is repo-wide rather than PR-specific:
docs/release_notes/0.230.0.mdand fails with the samefour failures. A markdown file cannot break Go unit tests.
no change to its contents. Only
mainmoved, and no merged commit touchedpkg/printersor the EKS SDK pin.ekswas not the only module affected. The same build also upgradedssm1.68.6 -> 1.73.5,iam1.58.1 -> 1.58.2, andelasticloadbalancingv21.58.5 -> 1.58.6.
Fix
Use
go mod downloadinstead ofgo get. It fetches the version alreadyselected in
go.modwithout modifying it, so generation happens against thepinned SDK.
All eleven services in
pkg/awsapi/generate/generate.go(ec2,autoscaling,cloudwatchlogs,cloudformation,cloudtrail,elasticloadbalancing,elasticloadbalancingv2,ssm,iam,eks,outposts) are directrequirements in
go.mod, so each resolves to its pinned version.Upgrading an SDK becomes an explicit, reviewable commit, which is what
Dependabot already handles.
Why this approach over regenerating the golden files
Regenerating the golden files against v1.91.0 would turn CI green today, but it
leaves builds non-reproducible and CI would break again the next time AWS adds a
field to
Cluster. Pinning addresses the cause; the existing golden files arealready correct for the pinned v1.88.0.
Testing
Verified
bash -non the script. The meaningful check is this PR's own CI: ifthe four
pkg/printersfailures clear, generation is running against v1.88.0 asintended.
Reviewers should also confirm whether the committed
pkg/awsapi/*.goshimsdrift, since they were last generated against an unpinned (newer) SDK. If
ifacemakeroutput differs for the pinned versions, that diff should becommitted separately so it is reviewed on its own.