我想在PowerShell脚本中使用Jenkins环境变量。在脚本中,${destination}的值为空。我无法确定我的错误。请帮我看看。
# !/bin/groovy
pipeline {
agent {
label {
label ""
customWorkspace "C:\\Jenkins\\workspace"
}
}
environment {
def destination=''
}
options {
timestamps()
timeout(time: 60, unit: 'MINUTES')
skipDefaultCheckout(true)
disableConcurrentBuilds()
}
stages {
stage('TEST')
{
steps {
script{
destination="\\\\SERVERNAME\\d\$"
}
echo "${destination}"
powershell '''
$destinationPath ="${destination}"
write-host $destinationPath
write-host "test3" '''
}
}
}
post {
always {
deleteDir()
}
}
${destination}
,请使用%destination%
。 - Manmohan_singh%destination%
将不会被解析。 - Marcel Melzig