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

BUILD_LOG_REGEX not replacing since plugin v2.0

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: token-macro-plugin
    • Labels:
      None
    • Environment:
      Ubuntu 16.04 LTS
      Token macro plugin 2.0
      Jenkins 2.7.4 (standalone)
      Build name setter plugin 1.6.5
      OpenJDK 1.8.0
    • Similar Issues:

      Description

      Log line:

      <span class="timestamp"><b>14:58:18</b> </span>version: 1.0.0-SNAPSHOT
      

      Using the "build name setter" plugin:

      #${BUILD_NUMBER} - {GIT_BRANCH}/${GIT_REVISION,length=6}/${BUILD_LOG_REGEX, regex="^.*?version: (.*?)$", substText="$1", maxMatches=1, showTruncatedLines=false }
      

      Expected result (works with TMP 1.12.1):

      #42 - origin/master/21dbab/1.0.0-SNAPSHOT
      

      Actual result (using TMP 2.0):

      #42 - origin/master/21dbab/${BUILD_LOG_REGEX, regex="^.*?version: (.*?)$", substText="$1", maxMatches=1, showTruncatedLines=false }
      

        Attachments

          Activity

          Hide
          slide_o_mix Alex Earl added a comment -

          The issue is the space at the end before the }. If you need it fixed now, just remove that space. I'll add in a check for whitespace in the parser for the next version.

          Show
          slide_o_mix Alex Earl added a comment - The issue is the space at the end before the }. If you need it fixed now, just remove that space. I'll add in a check for whitespace in the parser for the next version.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          .gitignore
          src/main/java/org/jenkinsci/plugins/tokenmacro/Parser.java
          src/test/java/org/jenkinsci/plugins/tokenmacro/TokenMacroTest.java
          http://jenkins-ci.org/commit/token-macro-plugin/e9b416c4b2af6dc1be10f28f50e7c9b958686bce
          Log:
          Fix JENKINS-38420

          Add optional whitespace before the end brace

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: .gitignore src/main/java/org/jenkinsci/plugins/tokenmacro/Parser.java src/test/java/org/jenkinsci/plugins/tokenmacro/TokenMacroTest.java http://jenkins-ci.org/commit/token-macro-plugin/e9b416c4b2af6dc1be10f28f50e7c9b958686bce Log: Fix JENKINS-38420 Add optional whitespace before the end brace
          Hide
          devminded Daniel Sandberg added a comment -

          Thank you very much. Removing the whitespace at the end solved the issue.

          Show
          devminded Daniel Sandberg added a comment - Thank you very much. Removing the whitespace at the end solved the issue.
          Hide
          slide_o_mix Alex Earl added a comment -

          FYI, the macro parsing was changed for 2.0 to allow more advanced capabilities. This is why the behavior changed in 2.0. I added a test to the test suite to cover this case.

          Show
          slide_o_mix Alex Earl added a comment - FYI, the macro parsing was changed for 2.0 to allow more advanced capabilities. This is why the behavior changed in 2.0. I added a test to the test suite to cover this case.
          Hide
          slide_o_mix Alex Earl added a comment -

          Will be fixed in 2.1

          Show
          slide_o_mix Alex Earl added a comment - Will be fixed in 2.1

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              devminded Daniel Sandberg
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: