码迷,mamicode.com
首页 > 其他好文 > 详细

Pipeline load and load from git

时间:2018-04-06 00:15:23      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:conf   configure   res   not   nload   repos   manage   install   man   

load

https://www.sourcefield.nl/post/jenkins-pipeline-tutorial/

 

 

node {
    // Use the shell to create the file ‘script.groovy‘ 
    sh ‘‘‘echo ‘
    def hello(name) {
        echo "Hello ${name} from script" 
    }
    return this
    ‘ > script.groovy‘‘‘
    def script = load ‘script.groovy‘
    script.hello(‘Roy‘)
}

 

 

load from git

 

Loading a script from another Git repository

This requires the Pipeline Remote File Loader plugin. The example assumes you have a repository somewhere that contains a Pipeline.groovy file, which you want to download to your Jenkins workspace.

  1. Go to Manage Jenkins > Manage Plugins and install Pipeline Remote File Loader (without restart)

  2. Configure a Pipeline job and set the Pipeline script to the following:

 

node {
    stage ‘Load pipeline script‘
    def pipeline = fileLoader.fromGit(
        ‘Pipeline.groovy‘, 
        ‘https://bitbucket.org/your-account/your-build-scripts.git‘, 
        ‘master‘, // use a branch or tag
        ‘your-account-credential-id‘, // ID from Credentials plugin
        ‘‘
    ) 
    checkout scm
    pipeline.execute()
}    

 

Pipeline load and load from git

标签:conf   configure   res   not   nload   repos   manage   install   man   

原文地址:https://www.cnblogs.com/lightsong/p/8724892.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!