String cron_string = BRANCH_NAME == "trunk" ? "40 3 * * *" : "" pipeline { agent { kubernetes agentsetup(containers: 'java8') } options { disableConcurrentBuilds() } triggers { cron(cron_string) } stages { stage('Main') { steps { sh """ ant build #ant -Djava.awt.headless=true test mvn clean site mvn -Ddistrib=/data/www/http.photoxchange.wamblee.org/ site:deploy """ } } } post { changed { mail to: "jenkins@wamblee.org", subject: "jenkins build:${currentBuild.currentResult}: ${env.JOB_NAME}", body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}" } } }