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

Ticket creation fails when no components in JIRA project exist / JIRA rejects empty component list

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • jira-plugin

    Description

      Having an issue getting the plugin to create a JIRA ticket. See the configuration screenshots attached for how I've got it setup.

      The error I'm getting is during a failed build is:

      Recording test results
      ERROR: Build step failed with exception
      java.lang.NullPointerException
              at hudson.plugins.jira.JiraSession.createIssue(JiraSession.java:310)
              at hudson.plugins.jira.JiraCreateIssueNotifier.createJiraIssue(JiraCreateIssueNotifier.java:153)
              at hudson.plugins.jira.JiraCreateIssueNotifier.currentBuildResultFailure(JiraCreateIssueNotifier.java:343)
              at hudson.plugins.jira.JiraCreateIssueNotifier.perform(JiraCreateIssueNotifier.java:115)
              at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
              at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
              at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
              at hudson.model.Build$BuildExecution.post2(Build.java:185)
              at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
              at hudson.model.Run.execute(Run.java:1766)
              at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
              at hudson.model.ResourceController.execute(ResourceController.java:98)
              at hudson.model.Executor.run(Executor.java:408)
      Build step 'Create Jira Issue' marked build as failure
      

      If I call our JIRA rest API from the server I can create an issue just fine.

      curl -D- -u username:password -X POST --data @data.txt -H "Content-Type: application/json" https://destinationnsw.atlassian.net/rest/api/2/issue/
      

      data.txt contains:

      {
          "fields": {
             "project":
             {
                "key": "BUGS"
             },
             "summary": "REST ye merry gentlemen.",
             "description": "Creating of an issue using project keys",
             "issuetype": {
                "name": "Bug"
             }
         }
      }
      

      I get "HTTP/1.1 201 Created" and the ticket is available.

      Attachments

        1. build_changelog.png
          35 kB
          Sandro Cirulli
        2. build_error_message_v141.png
          46 kB
          Sandro Cirulli
        3. build_error_message_v2.png
          66 kB
          Sandro Cirulli
        4. create_jira_issue.png
          27 kB
          Sandro Cirulli
        5. global config.png
          52 kB
          Thom Wilhelm
        6. jira_configuration.png
          53 kB
          Sandro Cirulli
        7. project config.png
          91 kB
          Thom Wilhelm
        8. project config - version 2.png
          21 kB
          Thom Wilhelm

        Activity

          Code changed in jenkins
          User: Radosław Antoniuk
          Path:
          src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java
          src/main/java/hudson/plugins/jira/JiraRestService.java
          src/main/java/hudson/plugins/jira/JiraSession.java
          http://jenkins-ci.org/commit/jira-plugin/43f5439fa5e5ea2dbc4b74773945b242db551913
          Log:
          JENKINS-30682 - Fix NPE on empty Component list in JIRA project. #nomerge - this was already changed in master.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Radosław Antoniuk Path: src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java src/main/java/hudson/plugins/jira/JiraRestService.java src/main/java/hudson/plugins/jira/JiraSession.java http://jenkins-ci.org/commit/jira-plugin/43f5439fa5e5ea2dbc4b74773945b242db551913 Log: JENKINS-30682 - Fix NPE on empty Component list in JIRA project. #nomerge - this was already changed in master.

          Code changed in jenkins
          User: Radosław Antoniuk
          Path:
          src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java
          src/main/java/hudson/plugins/jira/JiraRestService.java
          src/main/java/hudson/plugins/jira/JiraSession.java
          http://jenkins-ci.org/commit/jira-plugin/c3c8ca670a38913a2a9398a85662a0bbb8301638
          Log:
          Merge pull request #65 from jenkinsci/jira-2.0.3

          JENKINS-30682 - Fix NPE on empty Component list in JIRA project.

          Compare: https://github.com/jenkinsci/jira-plugin/compare/1a177053e8a8...c3c8ca670a38

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Radosław Antoniuk Path: src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java src/main/java/hudson/plugins/jira/JiraRestService.java src/main/java/hudson/plugins/jira/JiraSession.java http://jenkins-ci.org/commit/jira-plugin/c3c8ca670a38913a2a9398a85662a0bbb8301638 Log: Merge pull request #65 from jenkinsci/jira-2.0.3 JENKINS-30682 - Fix NPE on empty Component list in JIRA project. Compare: https://github.com/jenkinsci/jira-plugin/compare/1a177053e8a8...c3c8ca670a38

          Code changed in jenkins
          User: Radosław Antoniuk
          Path:
          src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java
          src/main/java/hudson/plugins/jira/JiraRestService.java
          src/main/java/hudson/plugins/jira/JiraSession.java
          http://jenkins-ci.org/commit/jira-plugin/23ee171d68e52c2f6634f11405c9620411a5c543
          Log:
          JENKINS-30682 - Fix NPE on empty Component list in JIRA project. #nomerge - this was already changed in master.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Radosław Antoniuk Path: src/main/java/hudson/plugins/jira/JiraCreateIssueNotifier.java src/main/java/hudson/plugins/jira/JiraRestService.java src/main/java/hudson/plugins/jira/JiraSession.java http://jenkins-ci.org/commit/jira-plugin/23ee171d68e52c2f6634f11405c9620411a5c543 Log: JENKINS-30682 - Fix NPE on empty Component list in JIRA project. #nomerge - this was already changed in master.

          Thom, I just released v.2.0.3, give it a try and let me know how it goes.

          warden Radek Antoniuk added a comment - Thom, I just released v.2.0.3, give it a try and let me know how it goes.
          thomwilhelm Thom Wilhelm added a comment -

          Hey warden thanks so much that's fixed the issue for us. Legend.

          Big up yourself.

          thomwilhelm Thom Wilhelm added a comment - Hey warden thanks so much that's fixed the issue for us. Legend. Big up yourself.

          People

            warden Radek Antoniuk
            thomwilhelm Thom Wilhelm
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: