简体   繁体   English

确定Jenkins作业的启动方式

[英]Determining how a Jenkins job was started

(I'm new to Jenkins and curl, so please forgive any imprecision below.) (我刚接触詹金斯和卷曲,所以请原谅下面的任何不精确。)

I am running a Jenkins job on one network that sends a curl command to a second network that is used to start a Jenkins job on that second network. 我在一个网络上运行Jenkins作业,该网络向第二个网络发送curl命令,该网络用于在第二个网络上启动Jenkins作业。

Sometimes I have to log onto that second network and restart the job using the Rebuild button provided by the Rebuild plugin. 有时我必须登录第二个网络并使用Rebuild插件提供的Rebuild按钮重新启动作业。

I need to know how to determine whether the job on the second network was started by the original curl command or restarted via the Rebuild plugin, without the user having to do anything but restart the job with the same parameters. 我需要知道如何确定第二个网络上的作业是由原始curl命令启动还是通过Rebuild插件重新启动,而用户不必执行任何操作,只需使用相同的参数重新启动作业。

I could use an extra boolean-parameter in the job on the second network that can be set to true by the curl command and to false when using the Rebuild button, but that requires the user to manually change the value of that parameter. 我可以在第二个网络上的作业中使用额外的布尔参数,可以通过curl命令设置为true,使用“重建”按钮时设置为false,但这需要用户手动更改该参数的值。 I don't want the user to have to do that. 我不希望用户必须这样做。

I think this only possible by using different users, or lets say an own user for the remote invocation. 我认为这只能通过使用不同的用户,或者让自己的用户进行远程调用。 Anything more informative would have to be done manually for instance by an own paramter for the job. 任何更具信息性的东西都必须手动完成,例如由自己的工作参数完成。 Normally jobs are started by developers, schedulers, hooks or by other jobs on the same instance. 通常,作业由开发人员,调度程序,挂钩或同一实例上的其他作业启动。 If triggered remotelly the job is triggered by a user as well, without authentication its the anonymus user who triggers the job. 如果触发remotelly,则该作业也由用户触发,而无需认证即可触发该作业的匿名用户。

Do you know the Jenkins CLI, could replace your curl commands? 你知道Jenkins CLI,可以替换你的curl命令吗?

https://jenkins.io/doc/book/managing/cli/ https://jenkins.io/doc/book/managing/cli/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM