DSL 脚本 `suppressFolderAutomaticTriggering` 属性不起作用

问题描述 投票:0回答:1

我编写了以下脚本来自动在 Jenkins 中创建作业。

根据这个视频我可以通过调整

suppressFolderAutomaticTriggering
属性来阻止构建风暴。

但是当我在 Jenkins 上运行我的脚本时,该属性不被尊重。 查看 API 文档,如下:https://jenkins.company/plugin/job-dsl/api-viewer/index.html#path/multibranchPipelineJob 我可以看到该选项就在那里 (检查下面的屏幕截图)

构建风暴非常烦人 - 所以任何帮助将不胜感激!

这是我的脚本...

def credentialsID = 'xxx'
def repoOWNER = 'xxx'
def branchDiscoverPatternWithTags = "(PR-\\d.*|qat|master|^v\\d.*)"

[
[repo: 'xxx-styleguide'],
[repo: 'xxx-phonebook-sync'],
[repo: 'xxx-library-dpp']
].each { Map config ->
    multibranchPipelineJob("${config.repo}") {
        description "\n WDDs ${config.repo} project"
        displayName("${config.repo}".replace('-', ' '))
        branchSources {
            branchSource {
                source {
                    bitbucket {
                        credentialsId("${credentialsID}")
                        repoOwner("${repoOWNER}")
                        repository("${config.repo}")
                        traits {
                            headRegexFilter {
                                regex("${branchDiscoverPatternWithTags}")
                            }
                            bitbucketTagDiscovery()
                            bitbucketPullRequestDiscovery {
                                strategyId(2)
                            }
                            bitbucketBranchDiscovery {
                                strategyId(3)
                            }
                        }
                    }
                }
            }
        }
        orphanedItemStrategy {
            discardOldItems {
                daysToKeep(1)
            }
        }
//The properties object is not working, so 'suppressFolderAutomaticTriggering' does't work causing a build storm
        properties {
            suppressFolderAutomaticTriggering {
                branches(".*")
                strategy("INDEXING")
            }
            }
        triggers {
            bitBucketMultibranchTrigger { }
        }
    }
}

jenkins-groovy jenkins-job-dsl
1个回答
0
投票

我也遇到了这个问题,因为properties.suppressFolderAutomaticTriggering似乎对多分支管道没有任何作用。

但是有branchSources.branchSource.strategy的选项;

multibranchPipelineJob('example') {
    ...
    branchSources {
        branchSource {
            ...
            strategy {
                allBranchesSame {
                    props {
                        suppressAutomaticTriggering {
                            strategy('NONE')
                            triggeredBranchesRegex('^$')
                        }
                    }
                }
            }
        }
    }
...
© www.soinside.com 2019 - 2024. All rights reserved.