Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62408

Stash Pullrequest Builder custom comments in pipeline

      Although pipeline support for this plugin is officially experimental, the trigger seems to work fine, and the only major missing feature I've found is the ability to customize the comment left on pull requests. I would love to see this available as a pipeline step. Potentially something like

      stashPostBuildComment(successfulComment: 'it worked', failedComment: 'it didnt')
      

      or even just one argument that sets the custom text, without having to specify success/fail:

      try {
          // build something ...
          stashPostBuildComment 'it worked'
      } catch (err) {
          stashPostBuildComment 'it didnt'
      }
      

      It feels like it should be possible to make the existing StashPostBuildComment class compatible with pipelines, but no idea how to actually go about doing it.

      As a workaround, I'm able to post a 2nd comment in a PR with something like

      import stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient
      
      StashApiClient stash = new StashApiClient(
          'https://bitbucket.example.com/',
          'username', 'password',
          'myProject', 'myRepo',
          false
      )
      stash.postPullRequestComment(pullRequestId, 'hello!')
      

      but it is sure feels clunky and doesn't work in the groovy sandbox without admin approval.

      I would love to know if there are better workarounds, or something simple I could do to help make this change (despite being a complete newbie in plugin development).

          [JENKINS-62408] Stash Pullrequest Builder custom comments in pipeline

          From proski

          The comment customization is currently configured in the post-build actions, not in the main trigger configuration. Pipelines don't show the post-build action GUI. I believe the customization should be moved to the main GUI. In fact, the code doesn't even post the comments from the post-build action, it posts from the onCompleted() method of RunListener associated with the build. Changing GUI means that the old configuration needs to be converted to the new configuration on upgrade, which requires configuration conversion code. When things move around, there are always confused users and a lot of questions. I just did not feel the comment customization was an important feature compared to the required effort to make it available in pipelines.

          Jakub Bochenski added a comment - From proski The comment customization is currently configured in the post-build actions, not in the main trigger configuration. Pipelines don't show the post-build action GUI. I believe the customization should be moved to the main GUI. In fact, the code doesn't even post the comments from the post-build action, it posts from the onCompleted() method of RunListener associated with the build. Changing GUI means that the old configuration needs to be converted to the new configuration on upgrade, which requires configuration conversion code. When things move around, there are always confused users and a lot of questions. I just did not feel the comment customization was an important feature compared to the required effort to make it available in pipelines.

          I don't plan to work on this any time soon. PRs are welcome

          Jakub Bochenski added a comment - I don't plan to work on this any time soon. PRs are welcome

            Unassigned Unassigned
            gpaciga Gregory Paciga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: