如何将管道参数传递给Shell脚本

时间:2019-11-04 10:55:26

标签: shell groovy jenkins-pipeline

我有一个Groovy文件,需要在shell脚本中使用管道参数:

def call() {
    echo "current build number: ${currentBuild.number}"
    def pipelineValue = "${currentBuild.number}"
    sh '''
        cd /jenkins/jenkins/workspace/Run_Distribution_Self_Service/
        mkdir -p builds/{pipelineValue }/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util
'''

如何在shell脚本中获取pipelineValue并使用它?

2 个答案:

答案 0 :(得分:1)

正确的语法:

mkdir -p builds/'''+pipelineValue+'''/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util

以下链接对我有帮助: Pass groovy variable to shell script

答案 1 :(得分:0)

let twoSingletons k v = 
  [ TreeNode(k, v, EmptyTree, EmptyTree)
    TreeNode(k, v, EmptyTree, EmptyTree) ]