Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65252

git-changelog: 3.1 Adds additional linebreaks and whitespaces to templates


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-changelog-plugin
    • None
    • Jenkins 2.277.1
      git-changelog-plugin 3.0 OK
      git-changelog-plugin 3.1 Has the bug

      We use the git-changelog plugin to push Jira issues into a slack channel. We have a mustasche-template that is a regular groovy-multiline string where we inject some variables and use the git-changelog plugin to inject Jira issues among other things.


      When we upgraded from 3.0 to 3.1 we noticed we were getting a bunch of extra spaces and linebreaks as in this picture below. 

      By only downgrading the plugin to 3.0 it went back to looking like this.


      This is the code we use to interact with the plugin:

      Map args = [
         returnType: 'STRING', 
         from: [type: 'REF', value: someVersion], 
         to: [type: 'REF', value: releaseVersion], 
         template: getSlackTemplate(releaseVersion, oldVersion, urlTemplate, repoPath, user),
         ignoreCommitsIfMessageMatches: commitFilter,
         removeIssueFromMessage: true, noIssueName: noIssueName
      String changelogSlack = gitChangelog(args + [template: getSlackTemplate(releaseVersion, oldVersion, urlTemplate, repoPath, user)])


      And this is what the template looks like:

      Release *${releaseVersion}* <${repoUrl}|${repoName}> (initiated by ${user})
      <{{link}}|{{issue}}> {{title}}
      <https://jira.company.com/browse/{{issue}}|{{issue}}> {{title}}
      {{issue}} {{title}}
      > {{messageTitle}} // {{authorName}}
      <${generateGitLabLink(repoUrl, oldVersion, releaseVersion)}|:gitlab: View on GitLab>



      One more thing we noticed is that the Jira issues does not resolve into links any more either with 3.1 so i guess it doesn't really pick Jira up anymore. I found nothing in the git-changelog-plugin code between those versions that should affect this behavior. 

            tomasbjerre Tomas Bjerre
            kitain Mikael Östberg
            0 Vote for this issue
            2 Start watching this issue