Current Date at Pipeline method-1

PHOTO EMBED

Thu Aug 05 2021 11:17:02 GMT+0000 (Coordinated Universal Time)

Saved by @juferreira #variable #groovy #jenkins #pipeline

pipeline {
    agent { label 'spot-instance' }
    
    environment {
        currentDate = sh(returnStdout: true, script: 'date +%Y-%m-%d').trim()
    }

        stage ('Run another Job'){
            steps {
                build job: "Release Helpers/(TEST) Schedule Release Job2",
                parameters: [
                    [$class: 'StringParameterValue', name: 'ReleaseDate', value: "${currentDate}"]

                ]
            }
        }
}

content_copyCOPY