Luca Gavazzeni
Luca Gavazzeni

Reputation: 113

How to define upstream and downstream project in Jenkinsfile

I have 3 projects (A, B, C).

The project A has as downstream the project B.

The project B has as upstream the project A and as downstream the project C.

The project C has as upstream the project B.

Now I have to define, in Jenkinsfile, the pipeline that allow to build automatically the projects B and C when the project A finish its build.

Any suggestion?

Upvotes: 2

Views: 3556

Answers (1)

rohit thomas
rohit thomas

Reputation: 2312

This is what you have A->B->C so in the JenkinFile of A

jenkinsFile

stage ('Starting Sub Jobs') {
   build 'JobB'
}

Similarly the JenkinsFile of B

jenkinsFile

stage ('Starting Sub Jobs') {
   build 'JobC'
}

So the JenkinsFile remain indepentdent of each other i.e.

If Job B is trigger then Job C will be triggered. But, if Job A is triggered, then Job B will be triggered which will in turn trigger job C.

Hope it helps :)

Upvotes: 2

Related Questions