tags:

views:

81

answers:

2
+2  Q: 

Hudson pipelines

Hi

Can anyone help with this problem?

I have a test job, a downstream job and a join job. I only want the join job to run if the downstream job succeeds.

If the test job fails and the downstream job succeeds I still want to run the join job.

Anyone know of a plugin that can help here?

The join plugin is not good enough because I can configure it to run join job when test AND downstream succeed, or run join regardless of either jobs success/failure. But not run join job ONLY if downstream succeeds.

Why do I want to do it this way? I want to pipeline jobs together but only if a common "downstream" job succeeds. If it fails then I want the pipeline to "break".

Adding more info to original question: So I have a set of tests (Test.1, Test.2, Test.3). I can run them individually from Hudson, they run, produce a result and finish. I also want to be able to run them as part of a pipeline. Test.1 runs, finishes and then runs Test.2. etc So I have two separate ways that I can run Test.1. Individual or as part of a pipeline. To help out here I have made Test.1, Test.2 etc parameterized (true/false). By default the param is false. So when I run Test.1 by default (false) the test runs and finishes. When I run Test.1 with param True I would like it to run Test.2. This second bit I cant seem to do

Many thanks John

A: 

Can't you just skip the join plugin and make the join job solely dependent on the downstream job ? That would satisfy your requirement of making the join job run only when the downstream job succeeds, as long as you make sure the "Trigger even if the build is unstable" box is unchecked on the dependency definition in the downstream build.

gareth_bowles
Cant do that because my downstream job is common to a long pipeline of jobs. That is, job A runs, calls downstream job, if downstream succeeds job B is run, calls downstream job, if downstream succeeds job c is run. The "downstream" job is a common check used by my whole job pipeline. Basically the "downstream" job will check to see if its parent job was run individually or as part of a pipeline. If individually then downstream fails (stopping the next child job from being run), if as part of a pipeline then downstream passes, initiating the next child job.Hope I'm explaining this ok!
johnoc
+1  A: 

Similar to Gareth_bowles, I would just chain all jobs (no join) and use the Hudson Parameterized Trigger plugin to start a dependent job even if the current job failed. Only disadvantage is, that you don't have jobs running parallel.

On a second thought, you can use the Hudson Parameterized Trigger plugin to run a temporary job after the test job, regardless of the success of the test job. The temporary job will always succeed (because it actually does nothing else than to trigger the join job. This way your test job (from the view of the join job) will always succeed and only the downstream job determines if the join job runs.

Edit

After understanding what you really want to do, namely run Test.N independently or as part of a chain, I would go with my first suggestion. That means Test.N always Triggers the Downstream.N job, regardless whether Test.N was successful or failed. You need the Hudson Parameterized Trigger plugin And configure two triggers. The first one triggers The dependent job when the test job is successful or unstable and the second trigger also triggers the dependent job but only when the test job fails. Don't forget to pass your parameters on and you are done. Not very complicated.

Peter Schuetze
Your second thought is very close to what I was trying to explain in my initial post. Except that sometimes I want that temporary job (I called it my downstream job) to fail. And when it does fail I want to stop the pipeline. But ONLY when downstream job fails do I want the pipeline to stop. If the original test job fails I want the pipeline to continue.
johnoc
I agree with you (johnoc) that it is close, however, I still incorporate the join plugin. This gives the benefit that the join job runs after both (dependent job and test job are done). If he wouldn't have needed this feature of the join plugin, he probably wouldn't have used it to begin with. If you don't use the join and the build job triggers the downstream and test jobs but only the downstream job triggers the join job, the join job might run even though the test job is not finished jet.
Peter Schuetze
Heres an example pipeline of what I want to do:(Test.1, DownstreamCheck, join Test.2) (Test.2, DownstreamCheck, join Test.3)All jobs are parameterized TRUE/FALSE.If DownstreamCheck gets a FALSE param, then it Fails. And this should stop the join job from running.This is the only reason to stop a Test.N job from running.But when I try to implement this in Hudson I have two problems:1. The join config wont allow a parameter.2. The join Test.N job will not run if either DownstreamCheck or the parant Test.N job failed. I only want it to stop if DownstreamCheck fails.
johnoc
From where comes the False Param for the DownstreamCheck? If it is derived from Test.N-1 than just let Test.N be dependent on Test.N-1.
Peter Schuetze
So I have a set of tests (Test.1, Test.2, Test.3). I can run them individually from Hudson, they run, produce a result and finish.I also want to be able to run them as part of a pipeline. Test.1 runs, finishes and then runs Test.2. etcSo I have two separate ways that I can run Test.1. Individual or as part of a pipeline. To help out here I have made Test.1, Test.2 etc parameterized (true/false). By default the param is false. So when I run Test.1 by default (false) the test runs and finishes. When I run Test.1 with param True I would like it to run Test.2.This second bit I cant seem to do.
johnoc
can you add this new info to your initial question?
Peter Schuetze

related questions