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

Polling: Pattern for excluded messages doesn't match due to final line break

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      GIT Plugin 4.5.2, Jenkins 2.222.4
    • Similar Issues:

      Description

      1. add a message "Polling ignores commits with certain messages"
        .*\[maven-release-plugin\].*
      1. commit with this message - polling doesn't ignore the message
      2. Reason: the commit message string contains a final line break (commits I created locally, commits that are created on Jenkins host with CentOS)
      3. Analysis: I added some lines with listener.getLogger().println("[ABC] ...") to src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java
      4. Polling Log showed me that the message contains a line break that doesn't match with pattern - empty line in polling log:
          [ABC] Checking commit 4b22f7aacbf22359c46adbdf20b04c09cf8b890e: Found message [maven-release-plugin]
        
          [ABC]  >> excludedMessage: [.*\[maven-release-plugin\].*]
          [ABC]  >>>> Pattern IS set: .*\[maven-release-plugin\].*
          [ABC]  >> acceptedMessage: [[maven-release-plugin]
        ]
      1. Fix: I changed the following line in src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java:
          // old line that doesnt ignore the message
          excludedPattern = Pattern.compile(excludedMessage);
          // new line that works with the final line break
          excludedPattern = Pattern.compile(excludedMessage, Pattern.DOTALL);
          

      As I'm not a software developer, I'm not sure about side effects when adding Pattern.DOTALL to the code line I mentioned - but it works for me with simple patterns like .[maven-release-plugin].

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment - - edited

          Thanks for reporting the problem. You can work around the issue without any code change by using

          (?s).*\[maven-release-plugin\].*
          

          That doesn't fix the bug, but it lets you work without waiting for a fix in the plugin

          Show
          markewaite Mark Waite added a comment - - edited Thanks for reporting the problem. You can work around the issue without any code change by using (?s).*\[maven-release-plugin\].* That doesn't fix the bug, but it lets you work without waiting for a fix in the plugin

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            carstensteinchen Carsten
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: