Validate function tag literals before execution#4503
Open
AkashKumar7902 wants to merge 2 commits intokptdev:mainfrom
Open
Validate function tag literals before execution#4503AkashKumar7902 wants to merge 2 commits intokptdev:mainfrom
AkashKumar7902 wants to merge 2 commits intokptdev:mainfrom
Conversation
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds early validation for literal function.tag values to ensure they conform to OCI/Docker image tag syntax, preventing invalid tags from reaching runtime execution and failing later.
Changes:
- Validate literal (non-constraint-resolved)
function.tagvalues against an image tag regex before constructing the final image reference. - Factor literal-tag image construction into a helper (
imageWithLiteralTag) used by both semver-exact and non-semver tag paths. - Add test coverage for invalid literal tags (including a semver-valid-but-tag-invalid case).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/fn/runtime/tag_resolution.go | Adds image-tag syntax validation for literal tags and routes literal tag resolution through a helper returning actionable errors early. |
| pkg/fn/runtime/tag_resolution_test.go | Adds cases asserting invalid literal tags now fail during resolution rather than later at execution time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
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.
Summary
function.tagvalues against image tag syntax before constructing the function image reference.Motivation
Fixes #4500.
Invalid tag values that were neither semantic versions nor semantic version constraints could be appended to the image name and only fail later during function execution. This catches those values during tag resolution with an actionable error.
Validation
go test ./pkg/fn/runtimego test ./pkg/fn/...go test -cover ./pkg/fn/runtimego vet ./pkg/fn/runtimego run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 run ./pkg/fn/runtimeAI Assistance
I used OpenAI GPT-5 for code exploration, implementation assistance, and test drafting. I reviewed the changes and validated them locally.