Skip to content

fix(opscomments): skip key=value args as PR names#2712

Merged
zakisk merged 2 commits into
tektoncd:mainfrom
theakshaypant:fix/test-on-comment-params
May 11, 2026
Merged

fix(opscomments): skip key=value args as PR names#2712
zakisk merged 2 commits into
tektoncd:mainfrom
theakshaypant:fix/test-on-comment-params

Conversation

@theakshaypant
Copy link
Copy Markdown
Member

@theakshaypant theakshaypant commented Apr 30, 2026

📝 Description of the Change

When a user posts "/test custom1=value", the key=value argument was being treated as a PipelineRun name, which bypassed on-comment annotation matching. Return empty string when the first argument contains "=" so the comment falls through to on-comment handling.

🔗 Linked GitHub Issue

Fixes #1952

🧪 Testing Strategy

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

e2e test on Forgejo with /test custom1=value run successfully.
image

🤖 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

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request ensures that key-value arguments in comments (e.g., /test key=value) are not incorrectly parsed as PipelineRun names, allowing them to be correctly handled by on-comment annotations. The changes include logic updates in pkg/opscomments and pkg/provider, supported by new unit and E2E tests. A critical feedback point identifies a regression in pkg/provider/provider.go where comments containing both a specific PipelineRun name and parameters would fail to extract the name correctly; a suggestion was provided to split the input string by spaces before validating the name.

Comment thread pkg/provider/provider.go Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 30, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.29%. Comparing base (c615efb) to head (6c11540).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2712      +/-   ##
==========================================
+ Coverage   59.25%   59.29%   +0.03%     
==========================================
  Files         208      208              
  Lines       20573    20590      +17     
==========================================
+ Hits        12191    12208      +17     
  Misses       7610     7610              
  Partials      772      772              

☔ 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.

@theakshaypant theakshaypant force-pushed the fix/test-on-comment-params branch from cd02b60 to 35bd553 Compare May 4, 2026 05:27
@theakshaypant
Copy link
Copy Markdown
Member Author

Will look at the deduplication of the opscomment logic in pkg/provider/provider.go and pkg/opscomment/comments.go and raise a separate PR for that if needed.

@theakshaypant theakshaypant marked this pull request as ready for review May 4, 2026 08:09
@chmouel
Copy link
Copy Markdown
Member

chmouel commented May 5, 2026

/retest

@zakisk zakisk force-pushed the fix/test-on-comment-params branch from 35bd553 to abfaa83 Compare May 5, 2026 11:30
@zakisk
Copy link
Copy Markdown
Member

zakisk commented May 5, 2026

/retest

@zakisk
Copy link
Copy Markdown
Member

zakisk commented May 6, 2026

When a user posts "/test custom1=value", the key=value argument was being treated as a PipelineRun name, which bypassed on-comment annotation matching. Return empty string when the first argument contains "=" so the comment falls through to on-comment handling.

but /test is GitOps comment not used in on-comment?

@zakisk zakisk force-pushed the fix/test-on-comment-params branch from abfaa83 to 0e146f9 Compare May 6, 2026 11:52
@theakshaypant
Copy link
Copy Markdown
Member Author

When a user posts "/test custom1=value", the key=value argument was being treated as a PipelineRun name, which bypassed on-comment annotation matching. Return empty string when the first argument contains "=" so the comment falls through to on-comment handling.

but /test is GitOps comment not used in on-comment?

This fix is only for the case when /test is also used for on-comment.

@zakisk
Copy link
Copy Markdown
Member

zakisk commented May 6, 2026

This fix is only for the case when /test is also used for on-comment.

I think then that's a collision

@zakisk
Copy link
Copy Markdown
Member

zakisk commented May 8, 2026

this looks good! but we should clarify in docs that do not use PaC's standard GitOps comments in on-comment annotation.

When a user posts "/test custom1=value", the key=value argument was
being treated as a PipelineRun name, which bypassed on-comment
annotation matching. Return empty string when the first argument
contains "=" so the comment falls through to on-comment handling.

Signed-off-by: Akshay Pant <akpant@redhat.com>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Add a note advising users not to use PAC's standard GitOps
commands (/test, /retest, /cancel, /ok-to-test) as on-comment
annotation patterns, since they are processed before on-comment
matching.

Signed-off-by: Akshay Pant <akpant@redhat.com>
@theakshaypant theakshaypant force-pushed the fix/test-on-comment-params branch from 0e146f9 to 6c11540 Compare May 11, 2026 06:18
@theakshaypant
Copy link
Copy Markdown
Member Author

this looks good! but we should clarify in docs that do not use PaC's standard GitOps comments in on-comment annotation.

Added a callout in 6c11540

@zakisk zakisk merged commit 861a507 into tektoncd:main May 11, 2026
23 of 25 checks passed
@theakshaypant theakshaypant deleted the fix/test-on-comment-params branch May 12, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/test Command Fails with Custom Parameters When Overriding Built-in GitOps Comment

4 participants