[英]How to to pass pipeline parameter to shell script
I have a groovy file which I need to use pipeline parameter in the shell script:我有一个 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
'''
How can I get the pipelineValue in the shell script and use it?如何在 shell 脚本中获取 pipelineValue 并使用它?
Correct syntax:正确的语法:
mkdir -p builds/'''+pipelineValue+'''/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util
the below link helped me: Pass groovy variable to shell script以下链接帮助了我: 将 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
'''
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.