Jenkins 下游(post 构建操作)作业的 DSL 是什么?

What is the DSL for Jenkins downstream (post build action) job?

我想这样做,但是在 Jenkins DSL 中:

如果在某个地方找到了这个,但它不起作用:

job('ps-first') {
    steps { shell('echo "landing"') }
    postBuildSteps { ...run other job here... }
        configure {
            it <<
                    'runPostStepsIfResult' { name('SUCCESS') }
        }
}

请在您自己的 jenkins 服务器上查看 https://your-jenkins-server/pipeline-syntaxsnippet generator 可以根据您安装的插件创建很多片段。

对于您的 post-构建步骤,我认为您正在寻找的是

build job: 'ps-archive', parameters: [
    string(name: 'Param1', value: 'someValue'),
    booleanParam(name: 'Bool', value: false,
    ...
    ], quietPeriod: 2, wait: false

如果要立即开始,您可以省略 quietPeriod

我找到了我要找的东西!

第一步是查看 xml 是如何从我的 UI 生成的 -> 转到 url 并将配置路径替换为 config.xml 然后在文档中找到发布者

https://jenkinsci.github.io/job-dsl-plugin/#path/freeStyleJob-publishers-downstream

中所述
job('ps-first') {
...
    publishers {
        downstream('ps-archive', 'SUCCESS')
    }
}