Jenkins-如何将$ {WORKSPACE}与字符串文字连接起来? [英] Jenkins - How to concatenate ${WORKSPACE} with a string literal?

查看:135
本文介绍了Jenkins-如何将$ {WORKSPACE}与字符串文字连接起来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的脚本管道代码(常规语法)中:

In the below scripted pipeline code(groovy syntax):

ws('/app/jenkins/workspace/abc/def/ghi'){
            sh './mvnw clean install
}

ws('/app/jenkins/workspace/abc/def/xyz'){
            sh './mvnw clean install
}

其中

/app/jenkins/workspace/abc/def${WORKSPACE}

ghi& xyz${WORKSPACE}

如何将${WORKSPACE}与子文件夹ghi连接并将值存储在someVar中?使用语法ws(someVar){}

How to concatenate ${WORKSPACE} with sub-folder ghi and store the value in someVar? to use the syntax ws(someVar){}

推荐答案

您可以尝试 ws("$ {WORKSPACE}/ghi"){....}

You can try ws("${WORKSPACE}/ghi"){ .... }

请注意使用gstring替换必须是双引号,单引号是典型的字符串

Pay attention to use gstring substitution must be double quotes, single quote is a typical string

这篇关于Jenkins-如何将$ {WORKSPACE}与字符串文字连接起来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆