I am using jiraEditIssue to update labels for a test case in JIRA, but the following error is thrown.
ERROR: {"errorMessages":[],"errors":{"labels":"The label '[Label1, Label2]' contains spaces which is invalid."}}
Jenkins file uses groovy lang. In groovy on adding elements into a list, by default whitespaces are added between the elements of the list in groovy. On passing such a list in jiraEditIssue via Jenkins file, I notice jira has a problem in accepting whitespaces between the elements of an array/list.
Kindly let me know, how would I resolve the above mentioned issue.
Further details regarding the same are mentioned below
def labelValue = [] as String[]
/* Im fetching values from the code and adding them to the list
def label1 = "Label1"
def label2 = "Label2"
labelValue.add(label1.replaceAll(" ",""))
labelValue.add(label2.replaceAll(" ",""))
def testIssue = [fields:
[
project: [key: "${projectKey}"],
labels: ["${labelValue}"],
issuetype: [id: '10413']
]
]
response = jiraEditIssue idOrKey: testCaseID, issue: testIssue, site: 'ALM_JIRA'
This is because you are converting a list to a string then making another list with that string as a single element.
Try
def testIssue = [fields:
[
project: [key: "${projectKey}"],
labels: labelValue,
issuetype: [id: '10413']
]
]
Thanks for the solution, it worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.