From 6b2f82ff03c9cbbbb3c11a3e7a786d41463b11da Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Mon, 29 Jul 2024 17:43:55 +0800 Subject: [PATCH] bugfix --- Jenkinsfile | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) 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("打包"){