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

Github Issues plugin not working in pipeline

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: github-issues-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.48; Github Issues plugin 1.2.2
    • Similar Issues:

      Description

      Attempting to use this plugin within a pipeline, I get the following exception:

      java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
      	at org.jenkinsci.plugins.githubissues.GitHubIssueNotifier.perform(GitHubIssueNotifier.java:139)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:78)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:65)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
      	at hudson.security.ACL.impersonate(ACL.java:260)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      

      The pipeline script is:

      node {
          try {
              sh "ls 1234"
          }
          finally {
              step([$class: 'GitHubIssueNotifier', 
                  issueAppend: true, issueBody: '''
                  Build \'$JOB_NAME\' has failed!
                  
                  Last 50 lines of output:
                  
                  ```
                  ${OUTPUT, lines=50}
                  ```
                  
                  [View full output]($BUILD_URL)''', 
                  issueLabel: 'Urgency-High', 
                  issueRepo: '<a repo>', 
                  issueTitle: '$JOB_NAME $BUILD_DISPLAY_NAME failed'])
          }
      }
      

        Attachments

          Activity

          benjamin_gill Benjamin Gill created issue -
          daniel15 Daniel Lo Nigro made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              daniel15 Daniel Lo Nigro
              Reporter:
              benjamin_gill Benjamin Gill
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: