jenkinsci/git-changelog-plugin

Jira title is not populated in git changelog output

Closed this issue · 3 comments

When reporting a bug, please try to provide as much information as possible.

  • Plugin version used. 2.23
  • Jenkins version used. 2.204
  • Your configuration:
   def changelogString = gitChangelog returnType: 'STRING',
        from: [type: 'REF', value:latestTag],
        to: [type: 'REF', value:'HEAD'],
        ignoreCommitsIfMessageMatches: '^Merge.',
        ignoreCommitsWithoutIssue: 'true',
    jira:[issuePattern: 'CICD', password: '', server: '', username: '']
        template: """
# Changelog

Changelog for {{ownerName}} {{repoName}}.

{{#tags}}
## {{name}}
 {{#issues}}
  {{#hasIssue}}
   {{#hasLink}}
### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
   {{/hasLink}}
   {{^hasLink}}
### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
   {{/hasLink}}
  {{/hasIssue}}
  {{^hasIssue}}
### {{name}}
  {{/hasIssue}}

  {{#commits}}
**{{{messageTitle}}}**

{{#messageBodyItems}}
 * {{.}} 
{{/messageBodyItems}}

[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*

  {{/commits}}

 {{/issues}}
{{/tags}}
---
"""
  • Expected result and actual result.
    Output should contain jira title
  • Any information from the logs:
    java.lang.RuntimeException: No template specified
    at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.perform(GitChangelogStep.java:404)
    at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.access$000(GitChangelogStep.java:44)
    at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1$1.call(GitChangelogStep.java:322)
    at hudson.FilePath.act(FilePath.java:1162)
    at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1.run(GitChangelogStep.java:326)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Finished: FAILURE

When I am using context then it doesn't show title.
Also let me know Is there any way to filter commit message title based on feature bugfix newchange"

You are missing , after jira:[issuePattern: 'CICD', password: '', server: '', username: ''].

You should do:

   def changelogString = gitChangelog returnType: 'STRING',
        from: [type: 'REF', value:latestTag],
        to: [type: 'REF', value:'HEAD'],
        ignoreCommitsIfMessageMatches: '^Merge.',
        ignoreCommitsWithoutIssue: 'true',
    jira:[issuePattern: 'CICD', password: '', server: '', username: ''],
        template: """
# Changelog

Changelog for {{ownerName}} {{repoName}}.

{{#tags}}
## {{name}}
 {{#issues}}
  {{#hasIssue}}
   {{#hasLink}}
### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
   {{/hasLink}}
   {{^hasLink}}
### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
   {{/hasLink}}
  {{/hasIssue}}
  {{^hasIssue}}
### {{name}}
  {{/hasIssue}}

  {{#commits}}
**{{{messageTitle}}}**

{{#messageBodyItems}}
 * {{.}} 
{{/messageBodyItems}}

[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*

  {{/commits}}

 {{/issues}}
{{/tags}}
---
"""

Thanks. Its working fine now :)

Please provide any example to filter git commit message