Jainish Kapadia
Jainish Kapadia

Reputation: 2611

Establish relationship between two Jenkins Jobs available on different Jenkins server

I am building Jenkins for Test / QA automation scripts, lets name it TEST_JOB. For application, I have application source code Jenkins build, name it DEV_JOB.

My scenario is when DEV_JOB completes execution (successfully), execute TEST_JOB immediately. I am aware about setting up project upstream / downstream [ Build after other projects are built ] to accomplish this task. But here, Problem is DEV_JOB is on different server than TEST_JOB. Due to which, TEST_JOB fails to recognize DEV_JOB.

Now, how would I achieve this scenario?

Upvotes: 1

Views: 667

Answers (1)

jazz
jazz

Reputation: 509

You can use Jenkins API for remote trigger of Job. Say you have job on DEV_JOB on JENKINS_1, add a penultimate step(or upstream/downstream project having only this step) which invokes TEST_JOB using remote API call of JENKINS_2 server. Example command would be

$(curl --user "username:password" "http://JENKINS_2/job/TEST_JOB/buildWithParameters?SOMEPARAMETER=$SOMEPARAMETER")

username:password is a valid user on JENKINS_2. Avoid using your own account here but rather a 'build trigger' account that only has permissions to start those jobs.

Upvotes: 1

Related Questions