Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{title}} is not working #50

Closed
TitliBasu37 opened this issue Aug 10, 2020 · 12 comments
Closed

{{title}} is not working #50

TitliBasu37 opened this issue Aug 10, 2020 · 12 comments

Comments

@TitliBasu37
Copy link

TitliBasu37 commented Aug 10, 2020

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

@tomasbjerre
Copy link
Collaborator

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.

@TitliBasu37
Copy link
Author

TitliBasu37 commented Aug 10, 2020

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

@TitliBasu37
Copy link
Author

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

@tomasbjerre
Copy link
Collaborator

tomasbjerre commented Aug 10, 2020 via email

@TitliBasu37
Copy link
Author

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

@TitliBasu37
Copy link
Author

TitliBasu37 commented Aug 11, 2020

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

@tomasbjerre
Copy link
Collaborator

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

@TitliBasu37
Copy link
Author

TitliBasu37 commented Aug 11, 2020

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

@TitliBasu37
Copy link
Author

Working thanks a lot

@sprnza
Copy link

sprnza commented Mar 12, 2022

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

@AndreasScharfCPB
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants