How to trigger jenkins job based on result of other job

24 views
Skip to first unread message

pradeep kumar

unread,
Nov 10, 2016, 1:17:46 PM11/10/16
to Jenkins Users
Hi All,

I have three jobs  (Build, deploy and test ) .Builds job will trigger for every one hr and generate the war . then it deploy job will trigger and deploy on test env and at last test job will trigger .
Build-->Deploy-->Test

But i want to trigger the Builds job based on success of Test job . If Test job is failure or unstable , my Build should not trigger . Only if Test job is success then the Build job has to triggger .

My Build has scheduled for every hr .

Please suggest me .


Thanks in advance.
pradeep 

taroc...@gmail.com

unread,
Nov 10, 2016, 1:39:07 PM11/10/16
to Jenkins Users
Perhaps the following snippet is something that you are looking for:

 node { 
     stage('Build') {
        build job: 'test-a', propagate: true
        build job: 'test-b', propagate: true
    }

}

By default propagate is set to true, so this is just to illustrate that you can ignore errors and failures.

You also need to make sure that in the jobs you invoke (test-a and test-b in this case) you need to clearly mark successes and failures as such.

node {
    currentBuild.result = "SUCCESS"
}

Hope this helps.
Reply all
Reply to author
Forward
0 new messages