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

How to set component while creating new issue

    Details

    • Similar Issues:

      Description

      Hi Team,

      Is there any way to add component while creating new issue using JIRA jenkins pipeline groovy script?

      We had tried to set the fields as mentioned below, while it is failing with error:

      Could you please support?

      def issue = [fields: [ // id or key must present for project.
                                     project: [id: 10601],
                                     summary: summaryStr,
                                     description: "Devops build request for version '$\{VERSION}'",
                                     priority: [name: 'Lowest'],
                                     //customfield_1000: 'customValue',
                                     // id or name must present for issueType.
                                     issuetype: [id: 10401],
                                     //components: [id: "10002"]
                                     components: [\{name: "AzACS"}]]]
                                    
      

      Jira-jenkins-intgtrn #426 Console [Jenkins]
      Creating new Jira Build Request
      JIRA: Site - ABS Jira - Creating new issue: IssueInput(update=null, fields={project={id=10601}, summary=Devops Build Request, Version : '170.9.165', description=Devops build request for version '170.9.165', priority={name=Lowest}, issuetype={id=10401}, components=[org.jenkinsci.plugins.workflow.cps.CpsClosure2@1f885bb6]})
      Error Code: -1
      Error Message: No serializer found for class org.jenkinsci.plugins.workflow.cps.DSL and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.thoughtslive.jenkins.plugins.jira.api.input.IssueInput["fields"]>java.util.LinkedHashMap["components"]>java.util.ArrayList[0]>org.jenkinsci.plugins.workflow.cps.CpsClosure2["delegate"]>org.jenkinsci.plugins.workflow.cps.CpsClosure2["delegate"]>WorkflowScript["binding"]>groovy.lang.Binding["variables"]->java.util.LinkedHashMap["steps"])

        Attachments

          Activity

          Hide
          luogf luo guofeng added a comment -

          Naresh Rayapati

          Creating new issue: IssueInput(update=null, fields={project={id=10601}, summary=summaryStr, description=Devops build request for version , priority={name=Lowest}, issuetype={name=Task}, components=[{id=10002}]})
          Error Code: -1
          Error Message: No serializer found for class org.thoughtslive.jenkins.plugins.jira.api.input.IssueInput and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
          Show
          luogf luo guofeng added a comment - Naresh Rayapati Creating new issue: IssueInput(update= null , fields={project={id=10601}, summary=summaryStr, description=Devops build request for version , priority={name=Lowest}, issuetype={name=Task}, components=[{id=10002}]}) Error Code: -1 Error Message: No serializer found for class org.thoughtslive.jenkins.plugins.jira.api.input.IssueInput and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
          Hide
          nrayapati Naresh Rayapati added a comment -

          luo guofeng: I couldn't find id for the component so I used name, here is the code and screenshot that the pipeline was success and I did verify that JIRA created was tagged with appropriate component. 

          node {
            stage('JIRA') {
              def testIssue = [fields: [ project: [key: 'xxxx'],
                                         summary: 'New JIRA Created from Jenkins.',
                                         description: 'New JIRA Created from Jenkins.',
                                         customfield_14802: ["XXXX"],
                                         components: [[name: 'component1']],
                                         issuetype: [name: 'Task']]]
          
              response = jiraNewIssue issue: testIssue, site: 'JIRA'
          
              echo response.successful.toString()
              echo response.data.toString()
            }
          }
          

          Find the attached screenshot

          Show
          nrayapati Naresh Rayapati added a comment - luo guofeng : I couldn't find id for the component so I used name, here is the code and screenshot that the pipeline was success and I did verify that JIRA created was tagged with appropriate component.  node { stage( 'JIRA' ) { def testIssue = [fields: [ project: [key: 'xxxx' ], summary: 'New JIRA Created from Jenkins.' , description: 'New JIRA Created from Jenkins.' , customfield_14802: [ "XXXX" ], components: [[name: 'component1' ]], issuetype: [name: 'Task' ]]] response = jiraNewIssue issue: testIssue, site: 'JIRA' echo response.successful.toString() echo response.data.toString() } } Find the attached screenshot
          Hide
          nrayapati Naresh Rayapati added a comment -

          Please make sure you were on the latest version of this plugin and just follow the groovy syntax to declare the input.  

          Show
          nrayapati Naresh Rayapati added a comment - Please make sure you were on the latest version of this plugin and just follow the groovy syntax to declare the input.  
          Hide
          nrayapati Naresh Rayapati added a comment -

          Roshni J / luo guofeng / Rakesh Kande / Rupali B Hope the above syntax worked?

          Show
          nrayapati Naresh Rayapati added a comment - Roshni J / luo guofeng / Rakesh Kande / Rupali B Hope the above syntax worked?
          Hide
          nrayapati Naresh Rayapati added a comment -

          Closing this one, please don't mind to reopen if you need more help. Thank you.

          Show
          nrayapati Naresh Rayapati added a comment - Closing this one, please don't mind to reopen if you need more help. Thank you.

            People

            • Assignee:
              nrayapati Naresh Rayapati
              Reporter:
              roshnij7 Roshni J
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: