如何使用声明性Jenkinsfile设置pipelineTriggers?

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

在脚本化的Jenkins文件中,您可以通过设置以下命令在“上游”项目上设置构建触发器:

properties([
    pipelineTriggers([
        upstream(
            threshold: 'SUCCESS',
            upstreamProjects: 'UpstreamJob\master'
        )
    ])
])

如何在multibranch管道作业中使用声明性Jenkins文件设置等效的pipelineTriggers?

如果我将pipelineTriggers放在'options'部分中,我会收到以下错误:

WorkflowScript: 20: Invalid option type "pipelineTriggers". Valid option types: [buildDiscarder, catchError, disableConcurrentBuilds, overrideIndexTriggers, retry, script, skipDefaultCheckout, skipStagesAfterUnstable, timeout, timestamps, waitUntil, withContext, withCredentials, withEnv, ws]
jenkins jenkins-pipeline
1个回答
2
投票

它不应该在'选项'中,而应在'触发器'部分。

尝试:

pipeline {
    triggers {
        upstream (
            threshold: 'SUCCESS',
            upstreamProjects: 'UpstreamJob\master'
        )
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.