Seems like Jira steps
works only in Scripted pipeline
. How can I make use of JIRA steps
inside Declarative pipeline
? I get the error Unsupported map entry expression for CPS transformation
when I try defining Jira steps inside pipeline.
stages {
stage('Create JIRA Ticket'){
steps{
script {
def jiraserver = "Demo"
def testIssue = [fields [
project [id: '10101'],
summary: '[Test] Code Scan - $BUILD_NUMBER ',
description: 'Automated Pipeline',
customfield_1000: 'customValue',
issuetype: [id: '10000']]]
response = jiraNewIssue issue: testIssue
echo response.successful.toString()
echo response.data.toString()
jiraAddComment site: 'Demo', idOrKey: 'Test-1', comment: 'Started Unit Tests'
}
}
}
I get the error WorkflowScript: 42: Unsupported map entry expression for CPS transformation in this context @ line 42, column 17 project [id: '10101'],
You have several syntax issues on the testIssue
parameter definition which causes the Unsupported map entry expression
exception.
The issues is that fields
and project
are dictionary keys and should be followed with :
.
In addition if you wish to interpolate the BUILD_NUMBER
in the summary use double quotes ( ""
).
The following should work:
def testIssue = [fields: [
project: [id: '10101'],
summary: "[Test] Code Scan - $BUILD_NUMBER",
description: 'Automated Pipeline',
customfield_1000: 'customValue',
issuetype: [id: '10000']]]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.