jenkinschangeset

how to set jenkins changeset exclude setting


I'd like to know if there is something opposite to changeset in Jenkins. For example, in the doc (https://www.jenkins.io/doc/book/pipeline/syntax/), an example is given for changeset setting:

when { changeset pattern: ".TEST\\.java", comparator: "REGEXP" } or when { changeset pattern: "*/*TEST.java", caseSensitive: true }

I'd like to know if I can set "changeset exclude" patterns so that the files match this pattern will not trigger certain stages.


Solution

  • You can use a negative lookahead regex pattern to create a changeset filter that excludes certain paths, for example:

    when {
      changeset pattern: '^(?!.*\.TEST\.java).*', comparator: "REGEXP"
    }