smartWork
smartWork

Reputation: 11

How to trigger Jenkins downstream jobs on condition based once build got success

I have a use case like 1 Jenkins deploy and 5 different test jobs with different git repositories.

I want to trigger the specific test job once deploy job is done dynamically.

In detail:-

Deploy job name: 'A'

Individual test job names: P, Q, R, S, T

once A job got success, then trigger job

R if repository url is matches with repository name R

else trigger

S if repository url is matches with repository name S

.....like wise

Can you please tell me how can i achieve this.?

Upvotes: 0

Views: 1744

Answers (1)

afxentios
afxentios

Reputation: 2568

You can easily achieve that by using Conditional BuildStep Plugin.

Add conditional steps as follow:

Build -> Add Build Step -> Conditional  Steps (multiple)

Then choose Regular expression match and have a local enviroment where you assign your repository url and execute your test job for this repository when the regular expression match this repository url. Create such a step for each one of your 5 repositories.

For example:

Regular expression match

Upvotes: 1

Related Questions