简体   繁体   English

如何在 Jenkins Pipeline 脚本中使用“参数化远程触发器插件”?

[英]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.

相关问题 无法使用jenkins参数化远程触发插件 - not able to use jenkins Parameterized Remote Trigger Plugin 如何为jenkins参数化的远程触发器插件设置远程主机 - how to setup remote host for jenkins parameterized remote trigger plugin 使用参数化触发器插件的Jenkins远程构建失败 - Jenkins remote build with Parameterized Trigger Plugin failed 使用Jenkins参数化远程触发插件“with File参数上传到远程降级Jenkins作业 - Use Jenkins Parameterized Remote Trigger Plugin" with File parameter to upload to the remote downsteream Jenkins job Jenkins 参数化远程触发器插件返回错误构建的状态 - Jenkins Parameterized Remote Trigger Plugin Returning the Status of the Wrong Build Jenkins参数化远程触发器插件以返回内部版本号 - Jenkins Parameterized Remote Trigger Plugin to return build number 如何根据来自 Build Failure Analyzer Jenkins 插件的错误类别发送电子邮件/触发参数化远程作业? - How to send email/trigger parameterized remote job based on error category from Build Failure Analyzer Jenkins plugin? 如何在詹金斯管道中使用参数化构建? - How to use parameterized build in jenkins pipeline? 如何在管道中使用ssh jenkins插件在远程计算机中远程执行 - How to use ssh jenkins plugin in pipeline to remotely execute in the remote machine 如何在Jenkins中使用'parameterized-scheduler'插件 - How to use the 'parameterized-scheduler' plugin in Jenkins
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM