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

SCM Skip plugin doesn't respect multiline commit messages

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • scmskip-plugin
    • Jenkins ver. 2.222.4
      SCM Skip v1.0.2
    • v1.0.3

      In our projects we use multi-line format commit messages when we want to skip a build:

       

      chore: Bump to version X.Y.Z
      [skip ci]
      

      The skip build step in the Jenkinsfile looks like this:

       

      stage('skip:build') {
        steps {
          // Skips a build if a commit message contains "[skip ci]"
          scmSkip(deleteBuild: true, skipPattern: '^.*\\[skip ci\\]')
        }
      }

      However, the plugin doesn't match the regexp and doesn't stop the pipeline. It looks like the plugin doesn't check against the entire commit message because in the logs I see the following:

      SCM Skip: Pattern ^.*\[skip ci\] NOT matched on message: chore: Bump to version 2.1.0
      

      I've tried to play around with different regex expressions but without luck. if I use a single-line format for the commits everything works as expected.

       

       

          [JENKINS-62751] SCM Skip plugin doesn't respect multiline commit messages

          Thank you very much for looking into the issue. Unfortunately, the problem persists.

          I'm using the latest v1.0.3 version and now I see in the pipeline the following:

          SCM Skip: Pattern .*\[skip ci\].* NOT matched on message: fix: Change the workers input variable type refactor: Make all worker group keys optional feat: Expose disk settings for each worker group chore: Update README

          The plugin merges the first lines of the recent commit messages. My commit log looks like this:

           

          commit bf995caaf95a3d068968b477aea04950db44b975 (HEAD -> master, origin/master)
          Author: Vadim Kadnikov
          Date: Tue Jun 30 16:17:15 2020 +0200
          chore: Update README
          
          commit 26a20d4f48e4ba6e868f3509087abe0ba0275efd
          Author: Vadim Kadnikov
          Date: Tue Jun 30 16:16:57 2020 +0200
          feat: Expose disk settings for each worker group
          
          commit c75e6344b761f1bf3651e47acec2f9573bd581ce
          Author: Vadim Kadnikov
          Date: Tue Jun 30 16:16:35 2020 +0200
          refactor: Make all worker group keys optional
          
          commit 26453da7244047783202af2dc305a8684c5e930a
          Author: Vadim Kadnikov
          Date: Mon Jun 29 17:58:14 2020 +0200
          fix: Change the workers input variable type
          

          However, when I trigger the next build with the following commit message (note, the commit message is multi-line this time):

          commit 478fc471b234553f97c00f5af9bbc9df5e89648f (HEAD -> master, origin/master)
          Author: Bot
          Date: Tue Jun 30 14:21:59 2020 +0000
          chore: Bump to version 2.2.0
          [skip ci]
          

           

          In the pipeline logs, I still see this:

          SCM Skip: Pattern .*\[skip ci\].* NOT matched on message: chore: Bump to version 2.2.0

          I suspect, the problem might be that the SCM plugin returns only the first lines of every commit message:

          1. https://github.com/jenkinsci/scmskip-plugin/compare/scmskip-1.0.3...develop#diff-a7e17a9599423dfe21740b0b8618e32cR5-R6
          2. https://github.com/jenkinsci/scmskip-plugin/compare/scmskip-1.0.3...develop#diff-a7e17a9599423dfe21740b0b8618e32cR157

          Vadim Kadnikov added a comment - Thank you very much for looking into the issue. Unfortunately, the problem persists. I'm using the latest v1.0.3 version and now I see in the pipeline the following: SCM Skip: Pattern .*\[skip ci\].* NOT matched on message: fix: Change the workers input variable type refactor: Make all worker group keys optional feat: Expose disk settings for each worker group chore: Update README The plugin merges the first lines of the recent commit messages. My commit log looks like this:   commit bf995caaf95a3d068968b477aea04950db44b975 (HEAD -> master, origin/master) Author: Vadim Kadnikov Date: Tue Jun 30 16:17:15 2020 +0200 chore: Update README commit 26a20d4f48e4ba6e868f3509087abe0ba0275efd Author: Vadim Kadnikov Date: Tue Jun 30 16:16:57 2020 +0200 feat: Expose disk settings for each worker group commit c75e6344b761f1bf3651e47acec2f9573bd581ce Author: Vadim Kadnikov Date: Tue Jun 30 16:16:35 2020 +0200 refactor: Make all worker group keys optional commit 26453da7244047783202af2dc305a8684c5e930a Author: Vadim Kadnikov Date: Mon Jun 29 17:58:14 2020 +0200 fix: Change the workers input variable type However, when I trigger the next build with the following commit message (note, the commit message is multi-line this time): commit 478fc471b234553f97c00f5af9bbc9df5e89648f (HEAD -> master, origin/master) Author: Bot Date: Tue Jun 30 14:21:59 2020 +0000 chore: Bump to version 2.2.0 [skip ci]   In the pipeline logs, I still see this: SCM Skip: Pattern .*\[skip ci\].* NOT matched on message: chore: Bump to version 2.2.0 I suspect, the problem might be that the SCM plugin returns only the first lines of every commit message: https://github.com/jenkinsci/scmskip-plugin/compare/scmskip-1.0.3...develop#diff-a7e17a9599423dfe21740b0b8618e32cR5-R6 https://github.com/jenkinsci/scmskip-plugin/compare/scmskip-1.0.3...develop#diff-a7e17a9599423dfe21740b0b8618e32cR157

          Cory Silva added a comment -

          This broke our pipelines that contained multiple commits in a changelog. Consider the scenario below. Before this merge the pipeline would rightfully NOT be skipped because the latest commit did NOT contain [ciskip]. It appears that after this PR multiple commits are treated as one multi-line commit.

          Please consider reverting:

          SCENARIO:
          commit 2: PR accepted
          commit 1: [ciskip] version bump 1.1.1

          Cory Silva added a comment - This broke our pipelines that contained multiple commits in a changelog. Consider the scenario below. Before this merge the pipeline would rightfully NOT be skipped because the latest commit did NOT contain [ciskip] . It appears that after this PR multiple commits are treated as one multi-line commit. Please consider reverting: SCENARIO: commit 2: PR accepted commit 1: [ciskip] version bump 1.1.1

          The issue was not resolved.

          Gregor Plavčak added a comment - The issue was not resolved.

          The regression with multiple commit messages being merged was fixed in JENKINS-63918 .
          To fix the original bug here one has to call a different method on the changeset (getMsg only returns the first line, getComment has the full message).

          Zbynek Konecny added a comment - The regression with multiple commit messages being merged was fixed in JENKINS-63918 . To fix the original bug here one has to call a different method on the changeset (getMsg only returns the first line, getComment has the full message).

          Zbynek Konecny added a comment - Fixed in https://plugins.jenkins.io/scmskip/releases/#version_50.vfb_3a_f04242a_a_

            plavc Gregor Plavčak
            terranisu Vadim Kadnikov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: