Merge pull request #35 from rtyler/11

Add the Code Valet Shared Libraries by default to instances.
This commit is contained in:
R. Tyler Croy 2017-08-25 16:15:35 -07:00 committed by GitHub
commit 00c3a55964
1 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,10 @@
* sensible defaults which are necessary
*/
import jenkins.model.*
import jenkins.plugins.git.GitSCMSource
import org.jenkinsci.plugins.workflow.libs.*
import jenkins.model.GlobalConfiguration
import org.jenkinsci.plugins.pipeline.modeldefinition.config.GlobalConfig
@ -12,3 +16,19 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.config.GlobalConfig
/* Set the default Docker label for Declarative Pipeline to .. wait for it .. docker */
GlobalConfig c = GlobalConfiguration.all().find { it instanceof GlobalConfig }
c?.dockerLabel = 'docker'
/* Add our global library properly */
List<LibraryConfiguration> libs = []
['pipeline-library', 'inline-pipeline-secrets'].each {
GitSCMSource source= new GitSCMSource(it, "https://github.com/codevalet/${it}.git",
null, null, null, false)
LibraryConfiguration lib = new LibraryConfiguration(it, new SCMSourceRetriever(source))
lib.implicit = true
lib.defaultVersion = 'master'
libs.add (lib)
}
GlobalLibraries.get().libraries = libs