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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • GIT Plugin 4.5.2, Jenkins 2.222.4

      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].

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

              Created:
              Updated: