Improve kpt version resolution in setup-go-kpt composite action - #4730
Open
aravindtga wants to merge 1 commit into
Open
Improve kpt version resolution in setup-go-kpt composite action#4730aravindtga wants to merge 1 commit into
aravindtga wants to merge 1 commit into
Conversation
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aravindtga
marked this pull request as ready for review
September 2, 2026 11:18
aravindtga
requested review from
efiacor,
kispaljr,
liamfallon and
mozesl-nokia
as code owners
September 2, 2026 11:18
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.
Description
What changed:
go mod edit -json(parsing therequireblock) instead ofgo list -m, reading the version directly from the targetgo.modwithout resolving the full module graph. This mirrors the approach already used by the siblingcheck-go-mod-replaceaction.kpt-version-fileinput so callers can resolve the kpt version from ago.moddifferent from the one used for Go setup. It defaults togo-version-file, preserving existing behaviour.::warning::annotations (missing version file, orgithub.com/kptdev/kptnot found in therequireblock) instead of a silently swallowed message, and log the resolved kpt version.set -euo pipefailand a file-existence check before use.kpt-fallback-versionfromv1.0.0-beta.65tov1.0.0(the current latest kpt release) so the safety-net default is not stale.Why it's needed:
krm-functions-cataloge2e-ci run showed the previousgo list -m ... 2>/dev/nulllogic returning an empty version and silently falling back, then installing a kpt binary that did not match the version the e2e module was built against.How it works:
go mod edit -json | jqreads the declared version straight from therequireblock of the resolved version file (kpt-version-fileif set, otherwisego-version-file), making resolution deterministic and authoritative.::warning::annotation is emitted and the action falls back tokpt-fallback-version.porch,krm-functions-catalog, andkrm-functions-sdk. The change is backward compatible: allinstall-kpt: "false"call sites are unaffected, and every install call site resolves to the same version as before (porchgo.mod->v1.0.0-beta.67,krm-functions-catalogtests/e2etest/go.mod->v1.0.0-beta.65.1). The new input is opt-in with a behaviour-preserving default, and the fallback default change is inert for current consumers because the fallback path is not exercised when kpt is a direct dependency.Type of Change
Checklist
AI Disclosure
If so, please describe how:
- Kiro to analyse the composite action and its consumers, verify version resolution behaviour, and draft the PR changes and PR description.