• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • jira-trigger-plugin
    • None

      A typical workflow in the ASF is:

      1. upload patch to a Jira issue
      2. set state to Patch Available via Submit Patch
      3. Jenkins testing + human reviews
      4. upload new patch
      5. go back to step 3 until reviews are all positive and Jira is closed or work is abandoned

      To enable this workflow, we currently handle the JIRA+Jenkins integration via the Apache Yetus' precommit-admin script located [here|https://github.com/apache/yetus/blob/master/precommit/src/main/python/jenkins-admin.py].  As more users move to pipeline jobs, authing via REST to trigger the other jobs is harder since Pipelines don't support token-based auth.  Before we start reworking this code (likely as Groovy code that calls buildJob() via hackery), we thought we'd check in on what Jenkins plug-ins  have to offer.

      jira-trigger-plugin is the closest to handle this workflow.  With it, checking the state is relatively easy (changelog matching, status = Patch Available). However, it doesn't appear that jira-trigger-plugin gives any sort of state of the attachment or that there was a new one uploaded.  In fact, my attempts to debug this led to trying to setting the Parameter mapping to 'attachment' or anything closely related  causing nothing getting executed.  (I don't have access to the logs to see if there is a stack trace, but I suspect that there is.)

      Hopefully I'm just missing something, but if not:

      My feature request would be this:  we need a way to trigger specifically on attachment changes and expose attachment details.
       

          [JENKINS-55374] JIRA Attachment Handling

          Wisen Tanasa added a comment -

          Thank you for the ticket. The jira-trigger-plugin is heavily relying on JIRA webhook feature, if the value that you are interested in is not available, it will not be available.

          I understand that you have managed to get your job triggered with status = Patch Available. One way you can achieve what you need is by utilising the jira-trigger-plugin injected environment variable, JIRA_ISSUE_KEY. You can use the issue key to hit JIRA back to retrieve the attachment information you need.

          Wisen Tanasa added a comment - Thank you for the ticket. The jira-trigger-plugin is heavily relying on JIRA webhook feature, if the value that you are interested in is not available, it will not be available. I understand that you have managed to get your job triggered with status = Patch Available. One way you can achieve what you need is by utilising the jira-trigger-plugin injected environment variable, JIRA_ISSUE_KEY. You can use the issue key to hit JIRA back to retrieve the attachment information you need.

          Thank you for the response.

          Unfortunately, it doesn't appear the status changes on subsequent attachment uploads.  So while that would work for the initial 'Submit patch', it doesn't work for any subsequent uploads.
           

          Allen Wittenauer added a comment - Thank you for the response. Unfortunately, it doesn't appear the status changes on subsequent attachment uploads.  So while that would work for the initial 'Submit patch', it doesn't work for any subsequent uploads.  

          Wisen Tanasa added a comment -

          You should be able to JIRA field id to "attachment" under JIRA Field Matcher, without comparing new value or old value. The job hence will always be triggered when there are attachment changes.

          Wisen Tanasa added a comment - You should be able to JIRA field id to "attachment" under JIRA Field Matcher, without comparing new value or old value. The job hence will always be triggered when there are attachment changes.

          That's what I thought too... but that doesn't seem to work either.
           

          Allen Wittenauer added a comment - That's what I thought too... but that doesn't seem to work either.  

          Wisen Tanasa added a comment -

          Can you follow the troubleshooting instruction here and copy the webhook payload that you get?

          Wisen Tanasa added a comment - Can you follow the troubleshooting instruction here and copy the webhook payload that you get?

            ceilfors Wisen Tanasa
            _a__w_ Allen Wittenauer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: