Skip to content

fix(bitbucketdatacenter): support on-comment annotation for non-gitops comments - #2911

Merged
zakisk merged 1 commit into
tektoncd:mainfrom
tricktron:bitbucket-dc-on-comment
Aug 26, 2026
Merged

zakisk merged 1 commit into
tektoncd:mainfrom
tricktron:bitbucket-dc-on-comment

Conversation

@tricktron

@tricktron tricktron commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📝 Description of the Change

Bitbucket Data Center silently drops non-gitops PR comments (pr:comment:added events that are not /test, /retest, /ok-to-test, or /cancel). This means the on-comment PipelineRun annotation never triggers on Bitbucket DC, while it works on GitHub, GitLab, and Gitea.

Additional Refactorings

Remove dead guards in Detect: The IsTestRetestComment, IsOkToTestComment, and IsCancelComment checks all returned the same result as the catch-all. Stripped them out. Detect just decides whether to process an event; ParsePayload handles classification via SetEventTypeAndTargetPR.

Fix EventType for bare gitops commands:

  • /testtest-all-comment, /retestretest-all-comment, /cancelcancel-all-comment

This means bare /retest now correctly goes through filterSuccessfulTemplates (only re-runs failed pipelines), matching all other providers.

🔗 Linked GitHub Issue

Fixes #2910

🧪 Testing Strategy

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

I could not test the E2E because I don´t have the infrastructure set-up for it. So I am relying on the CI for that one.

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

✅ 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

@tricktron

Copy link
Copy Markdown
Contributor Author

@chmouel @zakisk Could I get a /ok-to-test to see if the bitbucket e2e test passes?

@zakisk

zakisk commented Aug 7, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.66%. Comparing base (f85fc94) to head (1b44359).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2911      +/-   ##
==========================================
- Coverage   80.68%   80.66%   -0.02%     
==========================================
  Files         164      164              
  Lines       13907    13889      -18     
==========================================
- Hits        11221    11204      -17     
+ Misses       1966     1965       -1     
  Partials      720      720              
Flag Coverage Δ
unit-tests 80.66% <100.00%> (-0.02%) ⬇️

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.

@tricktron

Copy link
Copy Markdown
Contributor Author

@zakisk @chmouel Nice, the bitbucket e2e passed!

@tricktron

Copy link
Copy Markdown
Contributor Author

@zakisk, @chmouel Do you have time for a review?

@zakisk
zakisk force-pushed the bitbucket-dc-on-comment branch from 9290433 to cd7d1a7 Compare August 11, 2026 07:14
@zakisk

zakisk commented Aug 11, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@tricktron

Copy link
Copy Markdown
Contributor Author

@zakisk, @chmouel I don't see what actually fails in the CI. Can you check or rerun if flaky?

Comment thread pkg/provider/bitbucketdatacenter/parse_payload.go
Comment thread test/bitbucket_datacenter_on_comment_test.go Outdated
@zakisk

zakisk commented Aug 12, 2026

Copy link
Copy Markdown
Member

please squash your commits into one and we're good to go after comments resolution...

@chmouel

chmouel commented Aug 19, 2026

Copy link
Copy Markdown
Member

@zakisk we should help contributors instead of waiting weeks for smalls things, since we can push to their branches

@chmouel
chmouel force-pushed the bitbucket-dc-on-comment branch 2 times, most recently from 76240bf to 5b60259 Compare August 19, 2026 08:42
@chmouel

chmouel commented Aug 19, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@chmouel

chmouel commented Aug 19, 2026

Copy link
Copy Markdown
Member

/lgtm

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

Congrats @tricktron your PR Has been approved 🎉

✅ Pull Request Approved

Approval Status:

  • Required Approvals: 1
  • Current Approvals: 2

👥 Reviewers Who Approved:

Reviewer Permission Level Approval Status
@zakisk write
@chmouel admin

📝 Next Steps

  • Ensure all required checks pass
  • Comply with branch protection rules
  • Request a maintainer to merge using the /merge command (or merge it
    directly if you have repository permission).

Automated by the PAC Boussole 🧭

@zakisk

zakisk commented Aug 19, 2026

Copy link
Copy Markdown
Member

@zakisk we should help contributors instead of waiting weeks for smalls things, since we can push to their branches

I was about to do it today 🙂

@zakisk
zakisk force-pushed the bitbucket-dc-on-comment branch from 5b60259 to fc28517 Compare August 19, 2026 10:34
@tricktron
tricktron force-pushed the bitbucket-dc-on-comment branch from fc28517 to f5b2fc7 Compare August 19, 2026 11:50
@zakisk

zakisk commented Aug 19, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@tricktron
tricktron force-pushed the bitbucket-dc-on-comment branch from f5b2fc7 to e5e4a0a Compare August 19, 2026 13:07
@zakisk
zakisk force-pushed the bitbucket-dc-on-comment branch from e5e4a0a to 6f96589 Compare August 19, 2026 13:17
@zakisk

zakisk commented Aug 19, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@tricktron

Copy link
Copy Markdown
Contributor Author

@zakisk I had to add pr:open to the tests to test the gating of the comments. Can you rerun the ci?

@zakisk
zakisk force-pushed the bitbucket-dc-on-comment branch from 391269a to f15dbd4 Compare August 19, 2026 14:29
@zakisk

zakisk commented Aug 19, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@zakisk

zakisk commented Aug 20, 2026

Copy link
Copy Markdown
Member

/retest

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@zakisk

zakisk commented Aug 25, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@zakisk

zakisk commented Aug 25, 2026

Copy link
Copy Markdown
Member

/retest

@@ -111,25 +112,8 @@ func (v *Provider) ParsePayload(_ context.Context, _ *params.Run, request *http.
processedEvent.TriggerTarget = triggertype.PullRequest
processedEvent.EventType = triggertype.PullRequest.String()
} else if provider.Valid(eventType, []string{"pr:comment:added", "pr:comment:edited"}) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems inconsistent with the PR description "Drop pr:comment:edited: Removed from parsePayloadType and ParsePayload.",

@tricktron tricktron Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@theakshaypant Thanks for the headsup. Yes, we decided not to remove that and I updated / removed that part from the description just now.

@zakisk

zakisk commented Aug 25, 2026

Copy link
Copy Markdown
Member

@tricktron test TestGitlabIssueGitopsComment is always failing on your PR can you please check and fix and let me know if you can't I will take a look tomorrow

@zakisk

zakisk commented Aug 25, 2026

Copy link
Copy Markdown
Member

@tricktron test TestGitlabIssueGitopsComment is always failing on your PR can you please check and fix and let me know if you can't I will take a look tomorrow

@tricktron no worries I think it's not your PR I see that its failing on other PRs as well I will take a look. this is good to merge after that. thanks

@zakisk

zakisk commented Aug 26, 2026

Copy link
Copy Markdown
Member

/test go-testing

@zakisk
zakisk merged commit bccc549 into tektoncd:main Aug 26, 2026
34 of 45 checks passed
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.

Bitbucket Data Center: on-comment annotation does not trigger on non-gitops comments

5 participants