Pass groovy variable to shell script

前端 未结 5 2145
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 13:38

I just started learning groovy.I want to pass the svnSourcePath and svnDestPath to shell script in the svn copy command. But URL not rendered.

node {
 stage          


        
5条回答
  •  孤街浪徒
    2020-12-06 14:07

    +1 to Selvam answer

    following is my use case with parameter plugin

    String parameter name: pipelineParameter

    Default value: 4

    node {
      stage('test') {
            withCredentials([[...]]) {
              def pipelineValue = "${pipelineParameter}"  //declare the parameter in groovy and use it in shellscript
              sh '''
                 echo '''+pipelineValue+' abcd''''
                 '''
            }
    }}
    

    The above prints 4 abcd

提交回复
热议问题