Skip to content

rodrigocprates/jenkins-shared-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Jenkins Shared Library

Make use of a shared library to reuse code across multiple jobs.

Blog post: https://rodrigocprates.hashnode.dev/jenkins-shared-libraries

Setup instructions

  1. In Jenkins, go to Manage Jenkins → Configure System. Under Global Pipeline Libraries, add a library with the following settings:

    • Name: jenkins-shared-library
    • Default version: main (branch)
    • Retrieval method: Modern SCM
    • Select the Git type
    • Project repository: <git repository url>
    • Credentials: select an existing credential
  2. Then create a Jenkins job with the following pipeline:

    @Library('jenkins-shared-library') _
    
    stage('Demo') {
      common.sayHello("Rodrigo")
    }
    

Whenever a job is triggered, it will:

  • clone this shared library repo (with most updated code)
  • import the functions
  • run whatever function you call in your pipeline

About

An example of a Jenkins Shared Library to be used across different pipelines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages