diff --git a/Jenkinsfile b/Jenkinsfile index d90d3041..dcc82f9f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,15 @@ pipeline{ disableConcurrentBuilds() } + environment{ + + + CURRENT_TIME = """${sh( + returnStdout: true, + script: 'date "+%Y-%m-%d-%H-%M-%S"' + )}""" + + } @@ -15,27 +24,6 @@ pipeline{ } stages{ - stage('定义变量') { - steps { - script { - // 获取当前时间 - - def now = new Date() - - // 格式化时间,例如为 yyyy-MM-dd HH:mm:ss - def timeFormatter = new java.text.SimpleDateFormat("yyyy-MM-dd-HH-mm-ss") - def currentTime = timeFormatter.format(now) - - // 将格式化的当前时间存储为环境变量 - environment { - CURRENT_TIME = currentTime - } - } - - sh 'printenv' - } - } - stage("打包"){