Solved this by using:
multibranchPipelineJob('Foo') {
branchSources {
branchSource {
source {
git {
id('420')
credentialsId('Bar')
remote("[email protected]:foo/foobar.git")
}
}
buildStrategies {
excludeRegionBranchBuildStrategy {
excludedRegions('foo/bar/**/*')
}
}
On Wednesday, December 22, 2021 at 4:31:45 PM UTC+13 Melo Vi wrote:
> Hi all,
>
> I am working with a multibranch pipeline in a config.yaml building a code
> repo pulled from Git.
>
> I would like to not trigger a build if the code change falls within a
> certain set of files. The Job-DSL API Viewer seems to indicate that
> multibranchPipelineJob
> <https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.DslFactory.multibranchPipelineJob>
>
> lacks this support out of the box?
>
> I have configured the Multibranch build strategy extension
> <https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin>
> through the Jenkins configure user interface and the committed files
> matching the filter are successfully ignored by the periodic build trigger.
> (attached)
>
>
> However I would like to add this to my config.yaml so the change persists.
>
> A snippet of config.xml after configuring the above in the UI looks as
> such:
> ```
> <buildStrategies>
>
> <com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionBranchBuildStrategy
>
> plugin="[email protected]">
> <excludedRegions>**/*.py</excludedRegions>
>
> </com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionBranchBuildStrategy>
> </buildStrategies>
> ```
>
> However I am unsure how this maps to an entry in config.yaml.
>
> In config.yaml I have tried adding the following code block under Git
> <https://jenkinsci.github.io/job-dsl-plugin/#path/javaposse.jobdsl.dsl.DslFactory.multibranchPipelineJob-branchSources-git>
>
> ```
> configure { node ->
> node / 'buildStrategies' /
> 'com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionBranchBuildStrategy'
>
> {
> excludedRegions '**/*.py'
> }
> }
> ```
>
> however this does not seem to work either.
>
> Has anyone found a workable CasC solution to ignore triggering a build for
> certain specified excluded regions?
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/7cbaa70c-af4a-482c-b497-715dce21cda7n%40googlegroups.com.