String cron_string = BRANCH_NAME == "trunk" ? "10 3 * * *" : "" pipeline { agent { kubernetes agentsetup(containers: 'java8') } options { disableConcurrentBuilds() } triggers { cron(cron_string) } stages { stage('Main') { steps { sh """ mvn clean install site mvn -Ddistrib=/data/www/http.flexiblejdbcrealm.wamblee.org/ site:deploy ( cd deploy mkdir -p /data/www/http.flexiblejdbcrealm.wamblee.org/lib rm -f /data/www/http.flexiblejdbcrealm.wamblee.org/lib/*.jar cp target/*.jar /data/www/http.flexiblejdbcrealm.wamblee.org/lib ) cp site/src/index.html /data/www/http.flexiblejdbcrealm.wamblee.org """ } } } post { always { junit '**/surefire-reports/*.xml' cobertura coberturaReportFile: '**/target/site/cobertura/coverage.xml' } 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}" } } }