user1522820
user1522820

Reputation: 1604

How to stop a downstream job from being run if it is waiting for upstream job to finish in Jenkins?

I have 2 projects :- 1. Project A 2. Project B

Project A is the upstream project and Project B is the downstream project. Project B waits if Project A is already building. Project A triggers Project B on finishing successfully.

Now here is the scenario:-

Project A is building and Project B is waiting for Project A to finish. Project B immediately gets triggered once Project A finishes. But, Project A also triggers Project B on finishing. So, basically Project B runs twice.

My requirement is - only the job (of Project B) triggered by upstream project (Project A) should run and not the one which is waiting for the upstream project (Project A) to finish. The waiting job should get purged from the queue.

Upvotes: 1

Views: 2746

Answers (2)

HX_unbanned
HX_unbanned

Reputation: 597

There are many ways to do it.

I suggest to check out this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Throttle+Concurrent+Builds+Plugin

It has covered my most sadistic needs up to this date. :)

Upvotes: 1

Shiva Kumar
Shiva Kumar

Reputation: 3161

Have you tried blocking the build when upstream project is running? enter image description here

Upvotes: 0

Related Questions