How to Update Jenkins Build status in Jira ticket Issue ID

I’m having some configure issues with the Jenkins, trying to update the Build status in Jira Issue ID. for this, it used a plugin (Atlassian Jira Software Cloud) and my Jenkins file looks like this.

post {
  always {
    jiraSendDeploymentInfo environmentId: ‘development’, environmentName: ‘development’, environmentType: ‘development’, issueKeys: [’${issueId}’], serviceIds: [’${issueId}’], site: ‘[atlassian net](atlassian net/)’, state: ‘successful’

By this Process i got errors like bellow

jiraSendDeploymentInfo: FAILURE_DEPLOYMENT_REJECTED: Failed to send deployment information to Jira: atlassian net. Rejected deployments: [RejectedDeploymentResponse{key=DeploymentKeyResponse{pipelineId='Teraform/master'environmentId='COG1', deploymentSequenceNumber=61}, errors=[ApiErrorResponse{message='Issue Keys or Issue Ids must match the pattern '^\p{L}[\p{L}\p{Digit}_]{1,255}-\p{Digit}{1,255}|\d{1,255}$''}]}].

For this, if I give specific Issue ID to updates is able to achieve.

like this:

jiraSendDeploymentInfo environmentId: ‘development’, environmentName: ‘development’, environmentType: ‘development’, issueKeys: [‘COG1-6491’], serviceIds: [‘COG1-6491’], site: ‘[site.atlassian.net](site.atlassian.net/)’, state: ‘successful’

I want a process like this. Introducing the Jira Software plugin for Jenkins

I followed the above link is coming if I give a specific Issue ID in the Jenkins file.

I want to automate this process

Where are you getting the variable issueId from?

You are passing it like this:

issueKeys: [’${issueId}’]

You are passing the String ${issueId} literally instead of the value of the variable issueId.

To pass the variable use this:

issueKeys: [issueId]

Well at least for scripted pipeline the above will work, not sure how to use declarative pipeline. If the above doesn’t work try:

issueKeys: ["${issueId}"]