• 5
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      This was split from BSERV-11472 where the suggestions were:

      • It would be interesting to integrate Code Insights with the Jenkins Warnings plugin. I don't know whether anyone is working on that.
      • Jenkins has a feature that locally merges a pull request and then builds the result. I wonder if the annotations from that build could be usefully displayed by Bitbucket Server. It could result in more accurate annotations, but it would require the merge to be done in the same way on both servers, thus perhaps requiring the same version of Git.  
        • As of Bitbucket Server 7.0 this is not possible as Bitbucket Server will show the common ancestor diff, and not contain any merged lines
      • I see Bitbucket Server is already publishing refs with names like "refs/pull-requests/45/merge". If Jenkins (specifically the Bitbucket Branch Source plugin) used this instead of doing its own merge, it could then add the resulting Code Insights report to the automatic merge commit already known by Bitbucket Server. Alas, it seems Bitbucket Server 5.15.1 does not display Code Insights reports from such a commit in the open pull request that caused the automatic merge.
        • As of Bitbucket Server 7.0 this is not possible as Bitbucket Server will show the common ancestor diff, and not contain any merged lines. Additionally, `refs/pull-requests/*` are not part of public API and could change at any time

            [BSERV-11477] Better Code Insights <-> Jenkins integration

            Hi,

            Any update on this ?

            Jenkins checks-api is now mature and being integrated with many platform (GitHub, GitLab, Gerrit, Gitea and probably more that I miss).

            Thanks!

            Valentin Delaye added a comment - Hi, Any update on this ? Jenkins checks-api is now mature and being integrated with many platform (GitHub, GitLab, Gerrit, Gitea and probably more that I miss). Thanks!

            khughes@atlassian.com, although Bitbucket Server Implementation? · Issue #65 · jenkinsci/checks-api-plugin started out as a feature request for the Bitbucket Branch Source plugin, I think it is best to implement as a separate plugin that interoperates with both Bitbucket Branch Source and Bitbucket Server Integration plugins. That would make it easy to offer the same Code Insights features to users of both plugins, and allow improvements of Checks API without depending on Bitbucket Server Integration release schedules. So far, the only technical obstacle to such an implementation is JENKINS-64691 in the Bitbucket Server Integration plugin.

            Kalle Niemitalo added a comment - khughes@atlassian.com , although Bitbucket Server Implementation? · Issue #65 · jenkinsci/checks-api-plugin started out as a feature request for the Bitbucket Branch Source plugin, I think it is best to implement as a separate plugin that interoperates with both Bitbucket Branch Source and Bitbucket Server Integration plugins. That would make it easy to offer the same Code Insights features to users of both plugins, and allow improvements of Checks API without depending on Bitbucket Server Integration release schedules. So far, the only technical obstacle to such an implementation is JENKINS-64691 in the Bitbucket Server Integration plugin.

            Kristy added a comment -

            Thanks kalle.niemitalo, I've updated the issue and added the requested component and label.

            The request you linked on the Jenkins side is for Bitbucket Branch Source plugin, but Atlassian actually doesn't own that plugin and we're unlikely to add new features to it. We do, however, officially maintain the Bitbucket Server Integration plugin.

            Kristy added a comment - Thanks kalle.niemitalo , I've updated the issue and added the requested component and label. The request you linked on the Jenkins side is for Bitbucket Branch Source plugin, but Atlassian actually doesn't own that plugin and we're unlikely to add new features to it. We do, however, officially maintain the Bitbucket Server Integration plugin .

            A similar feature request has been filed at the Jenkins side: Bitbucket Server Implementation? · Issue #65 · jenkinsci/checks-api-plugin

            Kalle Niemitalo added a comment - A similar feature request has been filed at the Jenkins side: Bitbucket Server Implementation? · Issue #65 · jenkinsci/checks-api-plugin

            Please add the Code Insights component and/or the code-insights label to this issue, to make it easier to find.

            Kalle Niemitalo added a comment - Please add the Code Insights component and/or the code-insights label to this issue, to make it easier to find.

            Kalle Niemitalo added a comment - - edited

            If a Jenkinsfile already uses the Warnings Next Generation plugin to scan log files and publish issues to Jenkins, then it is quite possible to make the Jenkinsfile also translate the issues to Code Insights annotations and publish them to Bitbucket Server, without needing another plugin in Jenkins. The main difficulties for this approach are:

            • How to translate the SCM checkout URL to the REST API URL.
            • How to get the credential for the Bitbucket Server REST API requests.
            • Many useful methods in the Warnings Next Generation object model are not whitelisted to let Groovy scripts call them.
            • Jenkins doesn't seem to offer a pipeline step for an HTTP request, so this must be done with a separate program such as curl, which must then be installed first.
            • Cannot easily forward MSTest results to Code Insights. The Warnings Next Generation plugin can read a JUnit report file but not an MSTest report file. The MSTest plugin translates an MSTest report file to JUnit format but deletes it (MSTestPublisher.java) before Jenkinsfile can ask the Warnings Next Generation plugin to read it.
              • The xUnit plugin can likewise translate from MSTest to JUnit format and can be configured not to delete the JUnit file.

            Kalle Niemitalo added a comment - - edited If a Jenkinsfile already uses the Warnings Next Generation plugin to scan log files and publish issues to Jenkins, then it is quite possible to make the Jenkinsfile also translate the issues to Code Insights annotations and publish them to Bitbucket Server, without needing another plugin in Jenkins. The main difficulties for this approach are: How to translate the SCM checkout URL to the REST API URL. How to get the credential for the Bitbucket Server REST API requests. Many useful methods in the Warnings Next Generation object model are not whitelisted to let Groovy scripts call them. Apparently fixed by jenkinsci/warnings-ng-plugin#780 Jenkins doesn't seem to offer a pipeline step for an HTTP request, so this must be done with a separate program such as curl , which must then be installed first. Cannot easily forward MSTest results to Code Insights. The Warnings Next Generation plugin can read a JUnit report file but not an MSTest report file. The MSTest plugin translates an MSTest report file to JUnit format but deletes it ( MSTestPublisher.java ) before Jenkinsfile can ask the Warnings Next Generation plugin to read it. The xUnit plugin can likewise translate from MSTest to JUnit format and can be configured not to delete the JUnit file.

            Jenkins has Checks API and GitHub Checks plugins in development for the Google Summer of Code project GitHub Checks API for Jenkins Plugins. I imagine a similar Jenkins plugin could now be implemented for Code Insights in Bitbucket Server, but I don't know whether anybody is working on that yet. The Warnings Next Generation plugin was changed to support Checks API in JENKINS-54072, where Code Insights was mentioned in a comment.

            Kalle Niemitalo added a comment - Jenkins has Checks API and GitHub Checks plugins in development for the Google Summer of Code project GitHub Checks API for Jenkins Plugins . I imagine a similar Jenkins plugin could now be implemented for Code Insights in Bitbucket Server, but I don't know whether anybody is working on that yet. The Warnings Next Generation plugin was changed to support Checks API in JENKINS-54072 , where Code Insights was mentioned in a comment.

            Kalle Niemitalo added a comment - - edited

            I see Bitbucket Server is already publishing refs with names like "refs/pull-requests/45/merge"

            Bitbucket Server 7.0.1 apparently does not publish "refs/pull-requests/*/merge" for new pull requests any longer, although refs for older unmodified pull requests remain there. New pull requests have "refs/pull-requests/*/from" only. This might be related to "the switch from a 3-way diff to a 2-way diff in pull requests" in Bitbucket Server 7.0.0. So, the idea of having Jenkins post a Code Insights report to the merge commit created by Bitbucket Server isn't going to fly.

            In addition, the loss of "refs/pull-requests/*/merge" affects the Bitbucket Branch Source plugin of Jenkins. Filed JENKINS-61493.

            Kalle Niemitalo added a comment - - edited I see Bitbucket Server is already publishing refs with names like "refs/pull-requests/45/merge" Bitbucket Server 7.0.1 apparently does not publish "refs/pull-requests/*/merge" for new pull requests any longer, although refs for older unmodified pull requests remain there. New pull requests have "refs/pull-requests/*/from" only. This might be related to "the switch from a 3-way diff to a 2-way diff in pull requests" in Bitbucket Server 7.0.0. So, the idea of having Jenkins post a Code Insights report to the merge commit created by Bitbucket Server isn't going to fly. In addition, the loss of "refs/pull-requests/*/merge" affects the Bitbucket Branch Source plugin of Jenkins. Filed JENKINS-61493 .

              Unassigned Unassigned
              khughes@atlassian.com Kristy
              Votes:
              29 Vote for this issue
              Watchers:
              22 Start watching this issue

                Created:
                Updated: