Today's episode continues on from Episode 4 in developing the shared pipeline library to use for building projects for the Apache Maven project.
The mission of the Apache Software Foundation is to provide software for the public good. Since the Jenkinsfile will be part of the source code and hence released with the Apache Maven project, the Apache Maven project needs to ensure that the Jenkinsfile can be used by others. This is probably not a goal that everyone would share, but it means that we need a way to extract the information that is specific to a particular Jenkins master and encode it within an API that other Jenkins masters can then implement.
By the end of this episode, we have
- A very simple API for the Jenkinsfile in each Git repo that allows for a full matrix of builds across different JDKs and operating systems with the configuration of the scope of the matrix being the responsibility of the repository:
- The build uses build resources in parallel to get the result as fast as possible, but will fail fast to minimize resource wastage.
- We have extracted the Jenkins master specific environment details into a separate repository allowing other Jenkins masters to use our build without having to change their global configuration. This also allows us to change the Jenkins master configuration more easily.
If you are interested in the source code of the shared libraries, I have published it in this gist.