简体   繁体   中英

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.

Sometimes I have to log onto that second network and restart the job using the Rebuild button provided by the Rebuild plugin.

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.

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. 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.

Do you know the Jenkins CLI, could replace your curl commands?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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