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

Github Issues plugin not working in pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • github-issues-plugin
    • None
    • Jenkins 2.48; Github Issues plugin 1.2.2

      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'])
          }
      }
      

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

              Created:
              Updated:
              Resolved: