【发布时间】:2020-04-10 10:53:27
【问题描述】:
我在管道中有一个全局变量BACKUP_DIR_NAME,在管道内的 shell 脚本中,我想使用它构建路径,因此有以下代码 -
BACKUP_DIR_NAME="10-04-2020"
pipeline {
agent any
stages {
stage('First') {
steps {
script {
sh '''
BACKUP_DIR_PATH="/home/oracle/SeleniumFramework/SeleniumResultsBackup/"$BACKUP_DIR_NAME"/"
echo "Directory path is "$BACKUP_DIR_PATH
'''
}
}
}
}
}
执行此操作时,我可以看到 BACKUP_DIR_NAME 的值被评估为空。你能帮我更正上面的代码吗?
【问题讨论】:
-
我尝试回答上述建议的问题。但导致错误 -
groovy.lang.MissingPropertyException: No such property: BACKUP_DIR_PATH for class: groovy.lang.Binding
标签: jenkins jenkins-pipeline jenkins-groovy