我想在 powershell 脚本中使用 jenkins 环境变量。这里 ${destination} 在 powershell 脚本中为空。无法确定我在做什么错误。请帮忙
管道{
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()
}
Run Code Online (Sandbox Code Playgroud)
}