How to add timestamp for artifacts in Jenkins
问题 I have following Jenkisfile and I'm trying to upload the artifacts with a timestamp. import groovy.transform.Field @Field def timeStamp = Calendar.getInstance().getTime().format('YYYYMMdd-hhmmss',TimeZone.getTimeZone('CST')) node { stage('Creating some artifacts') { sh 'touch hello.txt hi.txt' } stage('Uploading artifacts') { def server = Artifactory.server ('art-1') def uploadSpec = """{ "files": [ { "pattern": "*.txt", "target": "repo1/Dev/${env.BUILD_NUMBER}/*.txt.${timeStamp}" } ] }"""