Created
May 29, 2019 16:55
-
-
Save monodot/f7a2b91efd5c2408eeebbc91fed2e819 to your computer and use it in GitHub Desktop.
Declarative Jenkins pipeline which reads a shared library from a private Git repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Firstly, you need to add a new Credential in Jenkins to access your Git. | |
Grab the ID of the Credential and use it in the credentialsId field below. | |
*/ | |
library identifier: 'mylibraryname@master', | |
//'master' refers to a valid git-ref | |
//'mylibraryname' can be any name | |
retriever: modernSCM([ | |
$class: 'GitSCMSource', | |
credentialsId: 'your-credentials-id', | |
remote: 'https://github.com/monodot/private-jenkins-library.git' | |
]) | |
pipeline { | |
agent any | |
stages { | |
stage('Demo') { | |
steps { | |
echo 'Hello world' | |
sayHello 'Dave' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment