Ecn*_*wal 1 groovy jenkins jenkins-pipeline
我有一个带有结帐步骤的Pipeline jenkins作业,我想修改它以接受分支作为参数.
目前,这是我们结账的方式:
stage('Prepare'){
steps {
checkout([$class: 'SubversionSCM', "..." remote: 'http://svn.xxx.bbb/svn/yyy/branches/version_2017']]])
}
}
Run Code Online (Sandbox Code Playgroud)
我想将结帐更改为:
checkout([$class: 'SubversionSCM', "..." remote: 'http://svn.xxx.bbb/svn/yyy/params.BRANCH/params.VERSION']]])
Run Code Online (Sandbox Code Playgroud)
有人做过类似的事吗?我无法弄清楚是否可以将字符串与作业参数连接起来.
Ste*_*ing 13
你缺少的东西是Groovy的String Interpolation:里面的双引号字符串,${..}
允许你包含groovy代码:
def test = 'world'
println "hello ${test}" // prints hello world
println 'hello ${test}' // prints hello ${test}
Run Code Online (Sandbox Code Playgroud)
所以在你的例子中,使用
remote: "http://svn.xxx.bbb/svn/yyy/${params.BRANCH}/${params.VERSION}"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
14066 次 |
最近记录: |