jenkinsci/git-changelog-plugin

{{title}} is not working

Closed this issue · 12 comments

Plugin version used: 2.10
Jenkins version used: 2.141
Your configuration:
def previousReleaseVersion = getCurrentReleaseVersion(RELEASE)
def currentReleaseTag = "${RELEASE}/" + previousReleaseVersion
print "Current Release tag: ${currentReleaseTag}"
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: '*****',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']])
{
def changelogString = gitChangelog returnType: 'STRING',
from: [type: 'REF', value: "${currentReleaseTag}"],
to: [type: 'REF', value: 'master'],
ignoreCommitsIfMessageMatches: '^Merge.',
ignoreCommitsWithoutIssue: 'true',
jira: [issuePattern: 'CICD'+ '-([0-9]+)\b',password: "${PASSWORD}", server: 'https://jira.com', username: "${USERNAME}"],
template: """

           <!DOCTYPE html>
<title>Change Log</title> <style> h2 { text-decoration: underline; } table { border: 1px solid black; border-collapse: collapse; width: 100%; } th, td { border: 1px solid black; border-collapse: collapse; text-align: left; padding: 8px; } tr:nth-child(even){background-color: #f2f2f2} th { background-color: #0099cc; color: white; } </style>

Change Log for {{repoName}}

JOB NAME: ${JOB_NAME}

BUILD ID: ${BUILD_ID}

GIT BRANCH:${GIT_BRANCH}

{{#tags}}

{{name}}

{{#issues}}
{{#hasIssue}}

{{/hasIssue}} {{^hasIssue}} {{/hasIssue}} {{/issues}}
JIRA ID JIRA TITLE GIT MERGES
{{issue}} {{title}} {{#commits}} {{{messageTitle}}}
{{hash}} {{authorName}} {{commitTime}}

{{/commits}}

{{/tags}} """

Expected result and actual result.
Expected : the 2nd collum should fetch the JIRA ticket summary tab with JIRA issue ticlet no
Actual : blank
{{title}} is not working

Any information from the logs: There is no error in logs 👍

Masking supported pattern matches of %USERNAME% or %PASSWORD%
[Pipeline] {
[Pipeline] gitChangelog
[Pipeline] writeFile
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // script

Try version 3.0 of plugin.
Try using jira api token.
Check both build log and jenkins global log.

This is likely a problem with integration with jira.

As a {{title}} exactly what should come in the output from a Jira ticket page ?

Thanks will try ...do u have any example using the plugin with jira api token

I tried upgrading the plugin version to 3.0....but still no luck...{{title}} field is coming blank :(

In our project...they are saying jira api token is not allowed to create as it will burden the jiras for the rest api calls...anyway the jira ticketid hyperlink is opening...but still not jira title is coming...any other way to populate the jira titles

That is expected when you do not supply cfedentials and this plugin will not be able to integrate with jira to get the title.

But I am supplying the credentials with class UsernamePasswordMultiBinding :

withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'CICD_Credential_ID',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']])
{
def changelogString = gitChangelog returnType: 'STRING',
from: [type: 'REF', value: "${currentReleaseTag}"],
to: [type: 'REF', value: 'master'],
ignoreCommitsIfMessageMatches: '^Merge.',
ignoreCommitsWithoutIssue: 'true',
jira: [issuePattern: 'CICD'+ '-([0-9]+)\b',password: "${PASSWORD}", server: 'https://jira.com', username: "${USERNAME}"],

But still why the {{title}} is not getting printed though jira tickets are opening in the changelog.html

Working thanks a lot

Hey @TitliBasu37 I've faced the same issue. Could you possibly recall how had you managed to solve the issue?

Hu @TitliBasu37 How is this working now?
I have got the same issue. I cannot get Jira issue title. Cannot find any information in the logs.
I am using hardcoded username and password for now to rule out any problems there.
Did you change anything in your Jenkins script? The Jira URL maybe?