Jenkins - How to concatenate ${WORKSPACE} with a string literal?

社会主义新天地 提交于 2019-12-13 03:19:28

问题


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
}

where

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

ghi & xyz are sub-folders within ${WORKSPACE}


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


回答1:


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

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



来源:https://stackoverflow.com/questions/54738257/jenkins-how-to-concatenate-workspace-with-a-string-literal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!