Jenkins Joy: Shared library for Jenkins Declarative Pipeline

Since the introduction of the Jenkins Declarative Pipeline syntax (as opposed to the Scripted Pipeline syntax) the concept of a shared library has become more important as we are otherwise restricted to the sections of the pipeline model. So we’ll make a basic set-up with a call to a defined step in a shared library.

A shared library called “jdriven” is configured globally in Jenkins (see link to at the end on how to do that). It has a defined step showQuote defined in it’s own file on branch “blog/shared-lib-example”


A basic Jenkinsfile defining the pipeline, calling step showQuote from the shared library:

More information on the Declarative Pipeline and the use of Shared Libraries at

Written using Jenkins 2.32.2 and Pipeline plugin 2.5

Leave a Reply

Your email address will not be published. Required fields are marked *