2

Jenkins CI is a very powerful tool, some plugins can be installed using it. Lately I have had a demand about two parallel processing jobs. We know that a lot of plugins have achieved this functionality, such as join plugin, Trigger parameterized plugin and so on. However I need another functionality as well.

The new functionality we want is the following:
Job A and Job B are processing parallel, if job A build fails, then Job B stops running instantly.

I haven't found any plugin achieving that.

Can you help me and inform me if there is any plugin with such functionality?

Thank you very much!

Bizley
  • 17,392
  • 5
  • 49
  • 59
Derrick zy
  • 29
  • 5

3 Answers3

0

You can use Post Build task plugin on your Job A and Job B.

You can set it to run when the jobs are failed: Log Text -> BUILD FAILED

And when the build is failed you can execute a Script to stop the job you want to be stopped using the jenkins API as it is being discussed here.

http://<Jenkins_URL>/job/<Job_Name>/<Build_Number>/stop
Community
  • 1
  • 1
afxentios
  • 2,502
  • 2
  • 21
  • 24
  • Happy to help, and welcome to Stack Overflow. If this answer helped you solve your issue, please mark it as accepted :) – afxentios Dec 29 '16 at 21:58
0

Use DSL Script with Build Flow plugin.

     JOB A
       |------> JOB B
       |------> JOB C 
                  |------> JOB D

try this Example for your execution:

build("job A")

parallel ( {build("job B")} {build("job C")} )

build("job D")

Ankit Gupta
  • 23
  • 1
  • 7
0

You can use pipeline parallel keyword.

stage('parallel job'){
        parallel{
            stage('job1'){
                steps{ build 'job-1'}
            }
            stage('job2'){
                steps{ build 'job-2'}
            }
        }
    }

Job-1 and Job-2 runs in parallel. If job-1 fails while job-2 is running, then job2 is aborted.

It goes to next stage, only if all parallel stages are done in success.

Ingyu Seo
  • 25
  • 4