首页 > 其他 > 详细

Pipeline load and load from git

时间:2018-04-05 23:56:42      阅读:350      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!