Skip to content

fix: skip comment-only YAML documents during parsing - #3014

Open
theakshaypant wants to merge 1 commit into
tektoncd:mainfrom
theakshaypant:fix-allow-comment-yaml
Open

theakshaypant wants to merge 1 commit into
tektoncd:mainfrom
theakshaypant:fix-allow-comment-yaml

Conversation

@theakshaypant

Copy link
Copy Markdown
Member

📝 Description of the Change

Comment-only documents in concatenated .tekton files caused "Object 'Kind' is missing" errors, blocking valid PipelineRuns from executing. Skip these documents before decoding.

🔗 Linked GitHub Issue

N/A

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation,
documentation, or testing.

Please indicate whether you have used AI assistance
for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

Copilot AI balanced review requested due to automatic review settings October 1, 2026 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Explicit YAML document-end markers are still misclassified as content and can reproduce the decoding error.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Skips comment-only YAML documents when resolving Tekton resources.

Changes:

  • Adds YAML-content detection before decoding.
  • Adds unit and E2E fixture coverage for comment-only documents.
File Description
pkg/​resolve/​resolve.go Filters comment-only documents.
pkg/​resolve/​resolve_test.go Tests comment-only document handling.
test/​testdata/​always-good-pipelinerun.yaml Adds comment-only document coverage to shared E2E data.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/resolve/resolve.go
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (4be1f06) to head (fe6b4a7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3014   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files         167      167           
  Lines       12913    12919    +6     
=======================================
+ Hits        11870    11876    +6     
  Misses       1042     1042           
  Partials        1        1           
Flag Coverage Δ
unit-tests 91.92% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@theakshaypant
theakshaypant force-pushed the fix-allow-comment-yaml branch 2 times, most recently from 458ac48 to 2192556 Compare October 5, 2026 03:42
@theakshaypant

Copy link
Copy Markdown
Member Author

/paco review

@pipelines-as-code

Copy link
Copy Markdown

Paco Review 🔍

This PR fixes a bug where YAML documents containing only comments (and no actual content) were being passed to the Kubernetes deserializer instead of being skipped. The fix introduces a hasYAMLContent helper that checks whether a document has any non-comment, non-whitespace lines before processing it. A test fixture (always-good-pipelinerun.yaml) is updated to include a comment-only document separator to exercise the fix. New table-driven tests cover the relevant scenarios.

Review difficulty: 2/5 (Easy) — Small, focused fix with a clear failure mode, limited blast radius, and straightforward logic.

1 new inline comment(s) found.

Reviewed commit: 2192556

@pipelines-as-code pipelines-as-code Bot added the paco/review-easy Paco review difficulty label Oct 5, 2026

@pipelines-as-code pipelines-as-code Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paco inline comments -- see the Paco Review summary comment for the overview.

Comment thread test/testdata/always-good-pipelinerun.yaml
@theakshaypant
theakshaypant marked this pull request as ready for review October 5, 2026 06:14
@theakshaypant
theakshaypant force-pushed the fix-allow-comment-yaml branch from 2192556 to 6ab00f2 Compare October 12, 2026 08:52
Comment-only documents in concatenated .tekton files caused
"Object 'Kind' is missing" errors, blocking valid PipelineRuns
from executing. Skip these documents before decoding.

Signed-off-by: Akshay Pant <akpant@redhat.com>
@zakisk
zakisk force-pushed the fix-allow-comment-yaml branch from 6ab00f2 to fe6b4a7 Compare October 17, 2026 13:35

This branch has not been deployed

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

Labels

paco/review-easy Paco review difficulty

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants