如何使用 github pull request builder 通过 jenkins job dsl 配置 Jenkins pipelineJob?

How to configure a Jenkins pipelineJob via jenkins job dsl with github pull request builder?

如何使用 github 拉取请求构建器通过 jenkins job dsl 配置 jenkins pipelineJob?

我试过:

pipelineJob("Test GHPRB") {
        properties {
            pipelineTriggers {
                triggers {
                    githubPullRequest {
                        useGitHubHooks()
                        orgWhitelist('orgName')
                        allowMembersOfWhitelistedOrgsAsAdmin()
                    }
                }
            }
        }
        definition { ... }
    }

但失败并出现错误:

No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.githubPullRequest() is applicable for argument types: (usIntJobs$_run_closure1$_closure3$_closure5$_closure6$_closure7) values: [usIntJobs$_run_closure1$_closure3$_closure5$_closure6$_closure7@72ad1a0f]

作为奖励,我将如何通过 jenkins job dsl 像这样配置它:

正如 NoamHelmer 在评论中所说,

Go to the DSL API viewer on your server (https://your.jenkins.installation/plugin/job-dsl/api-viewer/index.html) and search for ghprbTrigger thats the one you need for your pipeline job.

非常有用。为了完整起见,将 post 上面的作业 dsl 配置。

这是在pipelineJob.properties下:

ghprbTrigger {
    adminlist("myAdmin")
    whitelist("")
    orgslist('orgName')
    cron("")
    triggerPhrase(triggerPhraseStatement)
    onlyTriggerPhrase(true)
    useGitHubHooks(true)
    permitAll(false)
    autoCloseFailedPullRequests(false)
    displayBuildErrorsOnDownstreamBuilds(true)
    commentFilePath("")
    skipBuildPhrase("")
    blackListCommitAuthor("")
    allowMembersOfWhitelistedOrgsAsAdmin(true)
    msgSuccess("")
    msgFailure("")
    commitStatusContext("")
    gitHubAuthId("")
    buildDescTemplate("")
    blackListLabels("")
    whiteListLabels("")
    includedRegions("")
    excludedRegions("")
}