@@ -17,11 +17,10 @@ import org.hibernate.jenkins.pipeline.helpers.version.Version
1717// Global build configuration
1818env. PROJECT = " orm"
1919env. JIRA_KEY = " HHH"
20- def RELEASE_ON_PUSH = true // Set to `true` *only* on branches where you want a release on each push .
20+ def RELEASE_ON_SCHEDULE = true // Set to `true` *only* on branches where you want a scheduled release .
2121
2222print " INFO: env.PROJECT = ${ env.PROJECT} "
2323print " INFO: env.JIRA_KEY = ${ env.JIRA_KEY} "
24- print " INFO: RELEASE_ON_PUSH = ${ RELEASE_ON_PUSH} "
2524
2625// --------------------------------------------
2726// Build conditions
@@ -34,10 +33,17 @@ if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
3433}
3534
3635def manualRelease = currentBuild. getBuildCauses(). toString(). contains( ' UserIdCause' )
36+ def cronRelease = currentBuild. getBuildCauses(). toString(). contains( ' TimerTriggerCause' )
3737
3838// Only do automatic release on branches where we opted in
39- if ( ! manualRelease && ! RELEASE_ON_PUSH ) {
40- print " INFO: Build skipped because automated releases are disabled on this branch. See constant RELEASE_ON_PUSH in ci/release/Jenkinsfile"
39+ if ( ! manualRelease && ! cronRelease ) {
40+ print " INFO: Build skipped because automated releases on push are disabled on this branch."
41+ currentBuild. result = ' NOT_BUILT'
42+ return
43+ }
44+
45+ if ( ! manualRelease && cronRelease && ! RELEASE_ON_SCHEDULE ) {
46+ print " INFO: Build skipped because automated releases are disabled on this branch. See constant RELEASE_ON_SCHEDULE in ci/release/Jenkinsfile"
4147 currentBuild. result = ' NOT_BUILT'
4248 return
4349}
@@ -60,12 +66,15 @@ pipeline {
6066 agent {
6167 label ' Worker&&Containers'
6268 }
69+ triggers {
70+ // Run every week Sunday midnight
71+ cron(' 0 0 * * 0' )
72+ }
6373 tools {
6474 jdk ' OpenJDK 11 Latest'
6575 }
6676 options {
6777 buildDiscarder logRotator(daysToKeepStr : ' 30' , numToKeepStr : ' 10' )
68- rateLimitBuilds(throttle : [count : 1 , durationName : ' day' , userBoost : true ])
6978 disableConcurrentBuilds(abortPrevious : false )
7079 preserveStashes()
7180 }
0 commit comments