This is a Jenkins Shared Library that provides reusable pipeline steps for CI/CD workflows.
The library follows the standard Jenkins Shared Library structure:
src/: Contains Groovy classes that can be imported and used in pipeline scriptsvars/: Contains global variables/functions that can be called directly from pipeline scriptsresources/: Contains non-Groovy files that can be loaded via thelibraryResourcestep
A simple step that echoes "Hello world from the library!".
// In your Jenkinsfile
@Library('ci-library') _
pipeline {
agent any
stages {
stage('Hello') {
steps {
helloWorld()
}
}
}
}- In Jenkins, go to Manage Jenkins > Configure System
- Scroll down to the "Global Pipeline Libraries" section
- Click "Add" to add a new library
- Fill in the following details:
- Name: ci-library
- Default version: main
- Retrieval method: Modern SCM
- Select Git and provide the repository URL
- Save the configuration
Now you can use the library in your Jenkinsfiles as shown in the examples above.