GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add strict Tekton schema validation for Pipeline and PipelineRun templates by matejvasek · Pull Request #3855 · knative/func

Conversation

@matejvasek

@matejvasek matejvasek commented May 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@matejvasek @claude
test: add strict schema validation for PipelineRun templates
eea3fb5
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]>
@knative-prow
knative-prow Bot requested a review from dsimansk May 25, 2026 21:08
@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label May 25, 2026
@knative-prow
knative-prow Bot requested a review from jrangelramos May 25, 2026 21:08
@knative-prow knative-prow Bot added the size/M 🤖 PR changes 30-99 lines, ignoring generated files. label May 25, 2026
@matejvasek
matejvasek requested review from gauron99 and lkingland and removed request for dsimansk and jrangelramos May 25, 2026 21:08
@codecov

codecov Bot commented May 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ 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     
Flag Coverage Δ
e2e 33.69% <ø> (+11.93%) ⬆️
e2e go 29.60% <ø> (?)
e2e node 25.89% <ø> (?)
e2e python 29.93% <ø> (?)
e2e quarkus 26.00% <ø> (?)
e2e rust 25.45% <ø> (?)
e2e springboot 24.13% <ø> (?)
e2e typescript 25.99% <ø> (?)
e2e-config-ci 26.83% <ø> (ø)
integration 15.77% <ø> (?)
unit macos-14 42.24% <ø> (ø)
unit macos-latest 42.24% <ø> (ø)
unit ubuntu-24.04-arm 42.54% <ø> (ø)
unit ubuntu-latest 43.11% <ø> (ø)
unit windows-latest 42.31% <ø> (ø)

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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@matejvasek @claude
test: add strict schema validation for Pipeline templates
5b458c7
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]>
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/M 🤖 PR changes 30-99 lines, ignoring generated files. labels May 25, 2026
@matejvasek 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
@matejvasek
fixup style
ff4896e
Signed-off-by: Matej Vašek <[email protected]>
gauron99
gauron99 approved these changes May 26, 2026
View reviewed changes

@gauron99 gauron99 left a comment

Copy link
Copy Markdown
Contributor

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.

/lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@knative-prow knative-prow Bot assigned gauron99 May 26, 2026
@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label May 26, 2026
@knative-prow

knative-prow Bot commented May 26, 2026

Copy link
Copy Markdown

[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:
  • OWNERS [gauron99,matejvasek]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow
knative-prow Bot merged commit 180ccce into knative:main May 26, 2026
41 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gauron99 gauron99 gauron99 approved these changes
@lkingland lkingland Awaiting requested review from lkingland

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gauron99 gauron99

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.

Projects

None yet

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.

2 participants

@matejvasek @gauron99
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.