[英]How to use “Parameterized Remote Trigger Plugin” in Jenkins Pipeline script?
I tried search but didn't find any example.我试过搜索,但没有找到任何例子。 I tried https://jenkins.io/doc/pipeline/examples/#trigger-job-on-all-nodes and got it is for the different nodes on the same Jenkins.
我尝试了https://jenkins.io/doc/pipeline/examples/#trigger-job-on-all-nodes并得到它用于同一 Jenkins 上的不同节点。 I would like to trigger a build on another Jenkins.
我想在另一个 Jenkins 上触发构建。 I configured the Remote Hosts and Authentication in system configuration of my Jenkins.
我在 Jenkins 的系统配置中配置了远程主机和身份验证。 How to call "Parameterized Remote Trigger Plugin" in Jenkins Pipeline script?
如何在 Jenkins Pipeline 脚本中调用“参数化远程触发器插件”?
Seems to be an open bug: https://issues.jenkins-ci.org/browse/JENKINS-38657似乎是一个开放的错误: https : //issues.jenkins-ci.org/browse/JENKINS-38657
As a workaround you could create another job locally of an old type and use the plugin in the old school non pipeline script way.作为一种解决方法,您可以在本地创建另一个旧类型的作业,并以旧式非管道脚本方式使用该插件。 Then in your pipeline script you would just trigger this job.
然后在您的管道脚本中,您只需触发此作业。 I know it's an ugly adapter but then you have parametrize this adapter and have it up and running for almost anything ;)
我知道这是一个丑陋的适配器,但是你已经参数化了这个适配器并让它几乎可以运行任何东西;)
EDIT:编辑:
The bug 38657 is already closed, the plugin is available as pipeline step since 16th of May 2018. Usage should be as easy as:错误 38657 已经关闭,该插件自 2018 年 5 月 16 日起可作为管道步骤使用。使用应该很简单:
//Trigger remote job
def handle = triggerRemoteJob(remoteJenkinsName: 'remoteJenkins', job: 'RemoteJob')
More information on the triggerRemoteJob step有关triggerRemoteJob 步骤的更多信息
For anyone wondering how to do this using the Declarative Jenkinsfile Syntax:对于想知道如何使用声明性 Jenkinsfile 语法来做到这一点的人:
steps {
triggerRemoteJob remoteJenkinsName: 'configured-remote-jenkins-name', job: 'trigger-job-folder/trigger-job-name', blockBuildUntilComplete: true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.