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

Stash Pullrequest Builder custom comments in pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

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

        Attachments

          Activity

          Hide
          jbochenski Jakub Bochenski added a comment -

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

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

          From Pavel Roskin

          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.

          Show
          jbochenski Jakub Bochenski added a comment - From Pavel Roskin 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.

            People

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

              Dates

              Created:
              Updated: