-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitbucket Cloud PR Decoration - Annotation summary is displaying a URL instead of the user message #237
Conversation
… message instead of the SQ URL.
See issue #233. |
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.
Looks good for me!
Merged. Thanks for the contribution! |
@@ -26,7 +26,7 @@ | |||
public class CodeInsightsAnnotation { | |||
@JsonProperty("line") | |||
private final int line; | |||
@JsonProperty("message") |
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.
@mc1arke @ksl67 @marvin-w unfortunately since this change PR decoration fails with the following stracktrace for me:
sonarqube | com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.client.BitbucketException: The field 'message' is required
sonarqube | at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.client.BitbucketServerClient.validate(BitbucketServerClient.java:189)
sonarqube | at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.client.BitbucketServerClient.uploadAnnotations(BitbucketServerClient.java:114)
sonarqube | at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.BitbucketPullRequestDecorator.updateAnnotations(BitbucketPullRequestDecorator.java:153)
sonarqube | at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.BitbucketPullRequestDecorator.decorateQualityGateStatus(BitbucketPullRequestDecorator.java:98)
sonarqube | at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask.finished(PullRequestPostAnalysisTask.java:160)
The Code Insights API expects the field to be called message: https://docs.atlassian.com/bitbucket-server/rest/7.7.0/bitbucket-code-insights-rest.html#idp12
Maybe an additional field for summary is needed?
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.
I think there is a difference between Cloud and Server that went unnoticed in this PR - the Cloud API description lists the summary property, but not message property: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commit/%7Bcommit%7D/reports/%7BreportId%7D/annotations
This is a backport of mc1arke#237 on branch 1.3 (for SonarQube 7.8 to 8.0)
Many thanks for this fix. I have done this backport on branch release/1_3 (see https://github.com/mossroy/sonarqube-community-branch-plugin/tree/release/1_3 ), and tested it on SonarQube 7.9.5 : it works great. |
Yes, please create a PR 👍 |
@mossroy You don't need to raise a pull request - I'll cherry-pick the commits when I come to do a release 😄 |
Well or that :) thanks! |
I've just created PR #277 : feel free to close it if you prefer to cherry-pick. It's indeed the exact same changes, but on branch release/1_3 |
In #237 the property names of the annotation model were changed to fix a bug with how code annotations are reported to Bitbucket Cloud. This PR however did not take into consideration that the previous naming was actually correct and required for Bitbucket Server. With this change Bitbucket Cloud will continue to receive the message as summary (API docs), while Bitbucket Server receives the message as message again (API docs). The @JsonProperty annotations have been moved to the getters so that they support overrides, as mixing property-level and method-level annotations does not work for this use case. Technically this is only needed for the message property, but for consistency reasons this has been done for all fields and has been verified that this is mapped correctly for both cloud and server.
The message displayed in the annotation on the pull request is a URL which points to the issue in SonarQube.
This is because the
summary
field of the annotation body is serialisinglink
. See screenshot.Is this intentional? Would it not be better to serialise the message instead? Then the analysis message is visible directly in the PR.
Furthermore, I can't see anywhere in the Bitbucket API where
message
is specified in annotation body.Software Versions