Shared Libraries
Part of the Jenkins course
Open three Jenkinsfiles in your organisation and you will find the same fifteen lines of Groovy in all of them. The Slack notifier. The "build and push a Docker image" block. The deploy step that knows how your Kubernetes namespaces are named. They started identical and have since drifted, so fixing a bug in one leaves the other two broken, and nobody knows how many copies exist.
A shared library is Jenkins' answer: a separate git repository of Groovy that any pipeline can load and call as if its functions were built-in steps. Fix it once, and every pipeline picks up the fix on its next run.
Want to learn Jenkins Shared Libraries in a real environment?
Click below, get a fresh Linux box with Jenkins ready to go, and work through Shared Libraries hands-on with an AI tutor that knows your code.
Start this lessonShared LibrariesWhat you'll learn
- Vars folder
- Src folder
- @Library annotation
- Custom steps
- Global utilities
