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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • git-changelog-plugin
    • None
    • Jenkins 2.277.1
      git-changelog-plugin 3.0 OK
      git-changelog-plugin 3.1 Has the bug

    Description

      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})
      
      {{#issues}}
          {{#hasIssue}}
              {{#hasLink}}
      <{{link}}|{{issue}}> {{title}}
              {{/hasLink}}
              {{^hasLink}}
              {{#isJira}}
      <https://jira.company.com/browse/{{issue}}|{{issue}}> {{title}}
              {{/isJira}}
              {{^isJira}}
      {{issue}} {{title}}
              {{/isJira}}
              {{/hasLink}}
          {{/hasIssue}}
          {{^hasIssue}}
      {{name}}
          {{/hasIssue}}
          {{#commits}}
      > {{messageTitle}} // {{authorName}}
          {{/commits}}
      {{/issues}}
      
      <${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. 

      Attachments

        Activity

          tomasbjerre Tomas Bjerre added a comment -

          Thanks for reporting!

          Fixed here:

          https://github.com/tomasbjerre/git-changelog-lib/commit/bea18ab90db148c

          Released in the plugin as 3.2.

          Open issue again if not working.

          tomasbjerre Tomas Bjerre added a comment - Thanks for reporting! Fixed here: https://github.com/tomasbjerre/git-changelog-lib/commit/bea18ab90db148c Released in the plugin as 3.2. Open issue again if not working.
          kitain Mikael Östberg added a comment - - edited

          Verified working in 3.2

          Thank you for the speedy resolution tomasbjerre.

           

          And say hello to Karlskrona for me. 

          kitain Mikael Östberg added a comment - - edited Verified working in 3.2 !  Thank you for the speedy resolution tomasbjerre .   And say hello to Karlskrona for me. 

          People

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

            Dates

              Created:
              Updated:
              Resolved: