I need to trigger a job in server1 after the successful completion of a job in Server2. Both the servers are under same domain.
Asked
Active
Viewed 2,795 times
1

daspilker
- 8,154
- 1
- 35
- 49

Sreevalsa E
- 905
- 5
- 17
- 39
-
1Have you checked http://stackoverflow.com/questions/2674468/making-jenkins-hudson-job-depend-on-another-job ? Isn't this a similar case? – BTR Naidu Apr 28 '16 at 08:45
-
This is about triggering a job from another job. I want this to be done in between two servers. (Triggering job and the job to be triggered is in different servers) – Sreevalsa E May 04 '16 at 06:05
-
"under same domain" could mean "Same Jenkins Operation Center", or could simply mean share some naming in common. In general if you have a secure system (and you should) you'll need to have the credentials of the "other system" to use a "Remote Job Invocation" (see https://stackoverflow.com/questions/20359810/how-to-trigger-jenkins-builds-remotely-and-to-pass-parameters). If using Jenkins Operation Center, you can directly specify the remote job name with auto-complete options. – Steven the Easily Amused Jul 11 '17 at 20:27
2 Answers
0
Please have a look to the URLTrigger plugin for Jenkins.
Install this plugin on the server1.
On your server1/job, please configure the build trigger like below:
When the job will be completed on the server2, the server1/job will see a change on the buildNumber attribute. It will trigger a new build on server1.

Bruno Lavit
- 10,184
- 2
- 32
- 38
-
It's strange, I did a test between my production and my staging Jenkins server and it works. – Bruno Lavit May 04 '16 at 06:43
0
If you have a jenkins master, you could add the other servers as jenkins slaves and use the node('[slave name]') { ... }
feature of the workflow plug in to start a build on that slave.

ebnius
- 910
- 2
- 8
- 14
-
I want to trigger a job in other server and not run job in other server. – Sreevalsa E May 04 '16 at 06:03
-
In that case you can just use `build somejob` where `somejob` is another job where you'd have `node('other server name')` – ebnius May 04 '16 at 14:46
-
@ebnius: Make one jenkins master a slave of another jenkins master? That *might* work, but not do what the OP is asking. He has a Job1 in JenkinsA and wants to invoke Job2 in JenkinsB. – Steven the Easily Amused Jul 11 '17 at 20:30