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

queryParams ignored for jiraGetFields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • jira-steps-plugin
    • None
    • Jenkins: 2.190.3
      jira-steps-plugin: 1.5.3

      As per https://jenkins.io/doc/pipeline/steps/jira-steps/#jiragetfields-jira-steps-get-fields , `jiraGetFields` should accept `queryParams`, but it is ignored.

      Using below code:

      curl -s -u "${JIRA_USER_EMAIL}:${JIRA_API_KEY}" -H "Content-Type: application/json" "https://${JIRA_HOST}/rest/api/2/issue/createmeta?projectKeys=${JIRA_PROJECT}&issuetypeNames=Bug&expand=projects.issuetypes.fields" | jq '.projects|.[].issuetypes|.[].fields | with_entries({value: .key, key: .value.name})' | grep 'Result'
      

      on:

      1. Default project - yields:
         "Actual Result": "customfield_10540",
         "Expected Result": "customfield_10539",
        
      1. Test project - yields:
         "Actual Result": "customfield_10590",
         "Expected Result": "customfield_10591",
        

      Running below groovy snippet:

       def result = jiraGetFields site: '<SITE>', queryParams: [ projectKeys: '<PROJECT_ID>', issuetypeNames: 'Bug', ]//expand: 'projects.issuetypes.fields' ]
       def field_mapping = result.data.collectEntries {[
       (it.name): it.key
       ]}
       field_mapping.each { key, val ->
         if (key.contains('Result')) {
           println "${key}: ${val}"
         }
       }
      

      On both test and default projects, yields:

      JIRA: Site - <SITE> - Querying All Fields including Custom fields.
      Successful. Code: 200
      [Pipeline] echo
      Actual Result: customfield_10540
      [Pipeline] echo
      Expected Result: customfield_10539
      

            nrayapati Naresh Rayapati
            sbienkow Szymon Bieńkowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: