问题
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