GeezerVison is showing github.com — Add strict Tekton schema validation for Pipeline and PipelineRun templates by matejvasek · Pull Request #3855 · knative/func
Conversation
matejvasek
commented
May 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- Add
TestPipelineTemplatesValidate and TestPipelineRunTemplatesValidate which render all Tekton YAML templates and decode them into typed tektonv1.Pipeline / tektonv1.PipelineRun structs using a strict deserializer that rejects unknown fields
- Replace the string-based
Test_PipelineRunHasPodTemplateSecurityContext (from Fix remote Quarkus builds failing on s390x and ppc64le clusters #3665) with these schema-level validations
Motivation
PR #3665 added spec.podTemplate to PipelineRun templates, but this field is only valid in the Tekton v1beta1 API. In v1, it must be nested under spec.taskRunTemplate.podTemplate. The existing tests used strings.Contains on rendered YAML, which cannot catch misplaced fields — the string was present in the file, but Kubernetes silently ignored it (Warning: unknown field "spec.podTemplate").
These new tests would have caught that bug at CI time by failing with a strict decode error on the unknown field.
What changed
TestPipelineTemplatesValidate: renders packPipelineTemplate and s2iPipelineTemplate with real inline task specs, strict-decodes into tektonv1.Pipeline
TestPipelineRunTemplatesValidate: renders all 4 PipelineRun templates (pack/s2i × standard/PAC), strict-decodes into tektonv1.PipelineRun
- Shared helpers
strictTektonDecoder and renderTemplate extracted to reduce duplication
- Removed
Test_PipelineRunHasPodTemplateSecurityContext and its unused imports (os, strings)
Test plan
-
go test ./pkg/pipelines/tekton/ -run TestPipelineTemplatesValidate passes
-
go test ./pkg/pipelines/tekton/ -run TestPipelineRunTemplatesValidate passes
- All existing tests in the package continue to pass
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add TestPipelineRunTemplatesValidate which renders each PipelineRun
template and decodes it into a typed tektonv1.PipelineRun using a strict
deserializer that rejects unknown fields. This catches misplaced fields
like spec.podTemplate (valid only in v1beta1) that string-based tests
miss.
Signed-off-by: Matej Vašek <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
codecov
Bot
commented
May 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.42%. Comparing base (1e0ffb5) to head (ff4896e).
⚠️ Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3855 +/- ##
==========================================
+ Coverage 46.11% 53.42% +7.31%
==========================================
Files 200 200
Lines 23405 23405
==========================================
+ Hits 10793 12505 +1712
+ Misses 11634 9650 -1984
- Partials 978 1250 +272
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add TestPipelineTemplatesValidate which renders Pipeline templates with
real inline task specs and decodes them into typed tektonv1.Pipeline
using a strict deserializer. Extract shared helpers (strictTektonDecoder,
renderTemplate) used by both Pipeline and PipelineRun validation tests.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Matej Vašek <[email protected]>
matejvasek
changed the title
test: add strict schema validation for PipelineRun templates
Add strict Tekton schema validation for Pipeline and PipelineRun templates
May 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: gauron99, matejvasek
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Details
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gauron99
gauron99 approved these changes
lkingland
Awaiting requested review from lkingland
Uh oh!
There was an error while loading. Please reload this page.
Labels
approved
🤖 PR has been approved by an approver from all required OWNERS files.
lgtm
🤖 PR is ready to be merged.
size/L
🤖 PR changes 100-499 lines, ignoring generated files.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|