Over a million developers have joined DZone.

Watch Me Code, Episode 5 [Video]

DZone 's Guide to

Watch Me Code, Episode 5 [Video]

This coding video picks up the thread of developing a shared pipeline library to use for building Apache Maven projects.

· DevOps Zone ·
Free Resource

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:
    asfMavenTlpStdBuild(jdks:[7,8,9], os:['linux','windows']).
  • 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.

devops ,apache maven ,jenkins

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}