-
Bug
-
Resolution: Duplicate
-
Major
-
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:
- Default project - yields:
"Actual Result": "customfield_10540", "Expected Result": "customfield_10539",
- 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