Problems
Like database product, it runs on multi-platform, but for software enginner they may only works on one platform, how they could identify their code works on all platform? manually build the various platforms? NO!
Solution
Most people would know we can use Jenkins pipeline, they may create multi Jenkins job for different stuation.
How to do it in an elegant way, I would want to share how to use multibranch pipeline to achieve.
- When create a pull request, auto parallel start simple build.
- Reviewers can decide whether to merge base on build results.
- After code merged, auto start full build.
Benefits
What are the benefits:
- One Jenkins job and one pipeline can manage multi branches.
- Do not need to compile platforms to verify, save huge time and machines.
- Stop looking for other people’s mistakes, no one can break the build.
- Builds can be generated quickly for QA testing
Jenkinsfile example
In case of reduce simple build time and let PR creater and reviewer know the builds status as soon as possbile, you may need to do something different here, like below, used when condition and branch variable to check it is a develop branch or pull request branch.
when { |
The entire code pipeline looks like this:
// This Jenkinsfile is an explame for multibranch pipeline |