Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Pipeline: How to build job build after multibranch project is built?

Is it possible to define Build after other projects are built for Pipeline Multibranch, especially for org. folders like GitHub Organization or Bitbucket Tream/Project?

Example:

properties([pipelineTriggers([upstream(
        threshold: hudson.model.Result.SUCCESS,         
        upstreamProjects: "../multibranch-job/master")])])

Does it work? Does it require absolute or relative path?

like image 612
luka5z Avatar asked Oct 21 '16 12:10

luka5z


1 Answers

Apparently Build after other projects are built works just fine either with generic Pipeline, Multibranch, or Org. Folders like Bitbucket Team/Project.

My problem was related to the fact that I was referring to job with incorrect path.

Absolute Path:

An absolute path could be always found out in the upper section of job screen. This is especially useful if name contains special characters which might be replaced by Jenkins.

enter image description here

Thus the properties step should look:

properties([pipelineTriggers([upstream(
        threshold: hudson.model.Result.SUCCESS,         
        upstreamProjects: "t/multibranch-job-to-be-triggered/feature%2Ftest")])])

Relative Path:

Beside absolute path, you can refer to job with relative paths, ex:

  • another-branch
  • ../another-job/branch
like image 116
luka5z Avatar answered Sep 18 '22 14:09

luka5z