### Example .jenkinsignore File Content Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt This is an example of a `.jenkinsignore` file, which uses Ant-style patterns to specify files and directories that should be ignored by the build strategy. Lines starting with `#` are comments. ```text # Ignore documentation and asset changes README.md docs/** **/*.png **/*.svg ``` -------------------------------- ### Ant Path Pattern Examples Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Reference for Ant path patterns used in region-based strategies. These patterns define which files or directories should be included or excluded from triggering builds. Note that leading slashes are automatically stripped. ```text # Ant pattern examples for region strategies # (used in excludedRegions / includedRegions / file contents) * matches any characters within a single path segment (no /) ** matches any characters across path segments (including /) ? matches exactly one character README.md # exact file at repo root docs/** # everything under docs/ src/main/web/**/*.html # all .html files anywhere under src/main/web/ **/*.xml # all .xml files anywhere in the repo /src/main/java/** # leading / is automatically stripped ``` -------------------------------- ### Java Regex Pattern Examples for Message Strategies Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Reference for Java regular expressions used in message-based strategies. These patterns are matched against commit messages using `Matcher.find()`, allowing for partial matches. Comments and blank lines are ignored. ```text # Java regex examples for message strategies # (used in excludedMessages — matched with Matcher.find()) .*[ci-skip].* # message contains [ci-skip] anywhere .*[maven-release-plugin].* # maven release plugin automated commit ^chore:.* # conventional commit chore prefix .*Bump .* from .* to .* # Dependabot-style bump commit messages ``` -------------------------------- ### Configure Job DSL for Ignore File Strategy (Deprecated) Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Use this Job DSL snippet to configure the deprecated `ExcludeByIgnoreFileBranchBuildStrategy`. Ensure the ignore file path is correctly specified; it defaults to `.jenkinsignore`. ```groovy // Jenkins Job DSL — legacy .jenkinsignore approach (deprecated, prefer ExcludeRegionByFileBranchBuildStrategy) multibranchPipelineJob('my-service') { configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeByIgnoreFileBranchBuildStrategy' { ignorefilePath('.jenkinsignore') // defaults to .jenkinsignore if blank } } } } ``` -------------------------------- ### Trigger Build on Java File Changes Source: https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin/blob/master/README.md Use Ant patterns to specify file types or paths that should trigger a build. Each pattern must be on a new line. ```ant src/main/java/**/*.java ``` -------------------------------- ### Build by Included Regions (Repository File) Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt This strategy reads Ant inclusion patterns from a file within the repository, defaulting to `.jenkinsIncludeFile`. Builds are triggered only if changed files match patterns in this file. Specify the file path if it differs from the default. ```groovy // Jenkins Job DSL — inclusion patterns sourced from repo file multibranchPipelineJob('my-service') { configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.IncludeRegionByFileBranchBuildStrategy' { includeFilePath('.ci/include-regions.txt') // Defaults to .jenkinsIncludeFile if omitted } } } } // .ci/include-regions.txt (committed to the repository root) # Only trigger CI for backend source changes src/main/java/** src/test/java/** pom.xml src/main/resources/application*.properties // Behaviour: // Commit touches: src/main/java/Repo.java → build TRIGGERED // Commit touches: src/main/resources/application.properties → build TRIGGERED // Commit touches: src/main/web/index.html → build SKIPPED ``` -------------------------------- ### Exclude Specific Files from Triggering Builds Source: https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin/blob/master/README.md Configure exclusions for files like README.md, .gitignore, or any HTML files. Each exclusion should be on a new line. ```text README.md .gitignore **/*.html ``` -------------------------------- ### Build by Included Regions (UI Field) Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Use this strategy to trigger builds only when changed files match Ant inclusion patterns defined directly in the Jenkins UI. Ensure patterns are correctly formatted Ant-style paths. ```groovy // Jenkins Job DSL — only build when Java source files change multibranchPipelineJob('my-service') { configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.IncludeRegionByFieldBranchBuildStrategy' { includedRegions( '''src/main/java/**/*.java src/test/java/**/*.java pom.xml src/main/resources/**''' ) } } } } // Behaviour: // Commit touches: src/main/java/Service.java → build TRIGGERED (matches) // Commit touches: src/test/java/ServiceTest.java → build TRIGGERED (matches) // Commit touches: README.md → build SKIPPED (no match) // Commit touches: pom.xml AND README.md → build TRIGGERED (pom.xml matches) ``` -------------------------------- ### Exclude HTML and JPEG Changes from Triggering Builds Source: https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin/blob/master/README.md Use Ant patterns to specify file types or paths that should not trigger a build. Each pattern must be on a new line. ```ant src/main/web/**/*.html src/main/web/**/*.jpeg ``` -------------------------------- ### Exclude Build by Regions (Repository File) Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Use ExcludeRegionByFileBranchBuildStrategy to suppress builds by reading Ant exclusion patterns from a file within the repository. The default file path is .jenkinsExcludeFile. ```groovy // Jenkins Job DSL configuration — reads exclusions from a repo file multibranchPipelineJob('my-service') { configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionByFileBranchBuildStrategy' { // Omit to use default path: .jenkinsExcludeFile excludeFilePath('.ci/exclude-regions.txt') } } } } // .ci/exclude-regions.txt (committed to the repository root) // Lines starting with # are ignored # Documentation changes never trigger CI README.md docs/** *.md # Web assets — handled by a separate frontend pipeline src/main/web/**/*.html src/main/web/**/*.css src/main/web/**/*.jpeg // Behaviour: // Commit touches: docs/setup.md → build SKIPPED // Commit touches: src/main/java/App.java → build TRIGGERED // Commit touches: docs/setup.md AND src/main/java/App.java → build TRIGGERED ``` -------------------------------- ### Exclude Build by Regions (UI Field) Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Use ExcludeRegionByFieldBranchBuildStrategy to suppress builds when all changed files match Ant exclusion patterns. Patterns are entered directly in the Jenkins UI. ```groovy // Jenkinsfile / Jenkins Job DSL — multibranch pipeline configuration // Suppresses builds when only documentation or web assets change. // A commit touching src/main/java/App.java WILL trigger a build. // A commit touching only README.md and src/main/web/index.html will NOT. multibranchPipelineJob('my-service') { branchSources { git { remote('https://github.com/example/my-service.git') } } factory { workflowBranchProjectFactory { scriptPath('Jenkinsfile') } } configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionByFieldBranchBuildStrategy' { excludedRegions( // Ant patterns — one per line, lines starting with # are comments '''README.md .gitignore docs/** src/main/web/**/*.html src/main/web/**/*.jpeg''' ) } } } } // Equivalent exclusion pattern file content (plain text): // README.md // .gitignore // docs/** // src/main/web/**/*.html // src/main/web/**/*.jpeg // // Result: build is SKIPPED → commit only modifies README.md // Result: build is TRIGGERED → commit modifies src/main/java/Service.java ``` -------------------------------- ### Cancel Build by Excluded Commit Messages Source: https://context7.com/jenkinsci/multibranch-build-strategy-extension-plugin/llms.txt Use this strategy to suppress builds when the latest commit message matches any provided Java regex patterns. Each pattern should be on a new line. This is useful for skipping builds for automated commits. ```groovy // Jenkins Job DSL — skip builds for automated/release commits multibranchPipelineJob('my-service') { configure { node -> def strategies = node / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' strategies << { 'com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeMessageBranchBuildStrategy' { excludedMessages( // Java regex patterns — one per line // Each pattern is matched against the full commit message using Matcher.find() '''.*\ [ci\-skip\].* .*\ [maven\-release\-plugin\].* .*\ [skip ci\].* .*Bump .* from .* to .*''' ) } } } } // Behaviour (matching uses java.util.regex — Matcher.find(), not full-string match): // Commit message: "fix: resolve NPE [ci-skip]" → build SKIPPED (matches pattern 1) // Commit message: "[maven-release-plugin] prepare 1.2" → build SKIPPED (matches pattern 2) // Commit message: "Bump lodash from 4.17.20 to 4.17.21"→ build SKIPPED (matches pattern 4) // Commit message: "feat: add user authentication" → build TRIGGERED (no match) ``` -------------------------------- ### Prevent Builds for Specific Commit Messages Source: https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin/blob/master/README.md Use Java regex patterns to exclude commits containing specific phrases. Each pattern must be on a new line. ```regex .*[ci-skip].* .*[maven-release-plugin].* ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.