Jenkins pipeline to build multiple projects in sequence?
Solution 1
Yes, you can use build step to trigger any project (job) you want in Jenkins. See https://jenkins.io/doc/pipeline/steps/pipeline-build-step/
Solution 2
I know this question is a bit old. But in case there's someone out there that might be searching for an answer, follow these steps (Remember the names of the Jobs as you need to type them)
- Create a "Multijob Project"
- In the "Build" section, type the Name of your first Job.
- Again In the "Build" section, "Add build step" type the next Job name.
In both builds, "Block until the triggered projects finish" should be ticked.
Save & Build your Multijob Project.
Related videos on Youtube
Comments
-
christopolise almost 2 years
I am a novice when it comes to Jenkins. I would like to be able to take different projects and build them in sequence with each other with a Pipeline. I have noticed that Jenkins can run various stages in sequence or in parallel via a Pipeline. Is there a way for this to happen with running projects in sequence or in parallel that exists on the same node?
-
ben5556 over 5 yearsHi, can you please elaborate
I would like to be able to take different projects and build them in sequence with each other with a Pipeline
? Are you referring to GitHub/Bitbucket/GitLab projects here ? You can run stages in sequence or parallel and can choose to run them all on the same node or different nodes. -
christopolise over 5 yearsSure, in Jenkins, you can have different projects assigned to different nodes. This doesn't refer to any specific git projects, but rather the projects you create inside Jenkins itself. Is there a way to reference those projects inside of a jenkinsfile when defining a Pipeline?
-
ben5556 over 5 yearsYes, you can use
build
step to trigger any project (job) you want in Jenkins. See jenkins.io/doc/pipeline/steps/pipeline-build-step -
christopolise over 5 yearsHey thanks! That's exactly what I am looking for. If you want, you can post that as the answer so I can mark this solved.
-
ben5556 over 5 yearsSure added it as answer
-