This commit is contained in:
2024-07-29 17:43:55 +08:00
parent eb1cd4d7de
commit 6b2f82ff03

30
Jenkinsfile vendored
View File

@@ -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("打包"){