diff --git a/vars/daosPackagesVersion.groovy b/vars/daosPackagesVersion.groovy index 85ebbbf71..a3f6b3cb4 100644 --- a/vars/daosPackagesVersion.groovy +++ b/vars/daosPackagesVersion.groovy @@ -58,8 +58,10 @@ String call(String distro, String next_version) { String target_branch = env.CHANGE_TARGET ? env.CHANGE_TARGET : env.BRANCH_NAME if (target_branch.startsWith("weekly-testing") || - target_branch.startsWith("provider-testing")) { - // weekly-test just wants the latest for the branch + target_branch.startsWith("provider-testing") || + startedByTimer()) { + // weekly-test, provider-testing and timed builds just wants the latest + // for the branch if (rpm_version_cache != "" && rpm_version_cache != "locked") { return rpm_version_cache + rpm_dist(distro) } diff --git a/vars/daosRepos.groovy b/vars/daosRepos.groovy index c296f4d93..cc05f5b62 100644 --- a/vars/daosRepos.groovy +++ b/vars/daosRepos.groovy @@ -15,7 +15,8 @@ String daos_repo() { String target_branch = env.CHANGE_TARGET ? env.CHANGE_TARGET : env.BRANCH_NAME if (target_branch.startsWith("weekly-testing") || - target_branch.startsWith("provider-testing")) { + target_branch.startsWith("provider-testing") || + startedByTimer()) { return "" } diff --git a/vars/provisionNodes.groovy b/vars/provisionNodes.groovy index 46eb80215..addc2b7c8 100644 --- a/vars/provisionNodes.groovy +++ b/vars/provisionNodes.groovy @@ -145,6 +145,7 @@ def call(Map config = [:]) { 'INST_REPOS="' + inst_repos + '" ' + 'INST_RPMS="' + inst_rpms + '" ' + 'GPG_KEY_URLS="' + gpg_key_urls.join(' ') + '" ' + + 'TIMED_JOB=' + startedByTimer() + ' ' + 'ci/provisioning/post_provision_config.sh' new_config['post_restore'] = provision_script try { diff --git a/vars/skipStage.groovy b/vars/skipStage.groovy index ebb0a6a92..db1f77da5 100644 --- a/vars/skipStage.groovy +++ b/vars/skipStage.groovy @@ -143,7 +143,8 @@ boolean call(Map config = [:]) { return docOnlyChange(target_branch) || target_branch == 'weekly-testing' || rpmTestVersion() != '' || - quickBuild() + quickBuild() || + startedByTimer() case "checkpatch": return skip_stage_pragma('checkpatch') case "Python Bandit check": @@ -161,6 +162,7 @@ boolean call(Map config = [:]) { (docOnlyChange(target_branch) && prRepos('centos7') == '') || prRepos('centos7').contains('daos@') || + startedByTimer() || skip_stage_pragma('build-centos7-rpm') case "Build RPM on EL 8": case "Build RPM on CentOS 8": @@ -168,6 +170,7 @@ boolean call(Map config = [:]) { (docOnlyChange(target_branch) && prRepos('el8') == '') || prRepos('el8').contains('daos@') || + startedByTimer() || skip_stage_pragma('build-el8-rpm') case "Build RPM on Leap 15": return paramsValue('CI_RPM_leap15_NOBUILD', false) || @@ -175,6 +178,7 @@ boolean call(Map config = [:]) { (docOnlyChange(target_branch) && prRepos('leap15') == '') || prRepos('leap15').contains('daos@') || + startedByTimer() || skip_stage_pragma('build-leap15-rpm') case "Build DEB on Ubuntu 20.04": return paramsValue('CI_RPM_ubuntu20_NOBUILD', false) || @@ -182,6 +186,7 @@ boolean call(Map config = [:]) { (docOnlyChange(target_branch) && prRepos('ubuntu20') == '') || prRepos('ubuntu20').contains('daos@') || + startedByTimer() || skip_stage_pragma('build-ubuntu20-rpm') case "Build on CentOS 8": case "Build on EL 8": diff --git a/vars/startedByTimer.groovy b/vars/startedByTimer.groovy new file mode 100644 index 000000000..994a0b953 --- /dev/null +++ b/vars/startedByTimer.groovy @@ -0,0 +1,19 @@ +/* groovylint-disable VariableName */ +// vars/startedByTimer.groovy + +/** + * Return True the build was started by a timer + */ +Boolean call() { + + Boolean simulate_timed_job = cachedCommitPragma('Simulate-timed-job') == 'true' + + if (simulate_timed_job) { + println('Simulating timed job behaviour') + } + + return simulate_timed_job || + /* groovylint-disable-next-line UnnecessaryGetter */ + currentBuild.getBuildCauses().toString().contains('hudson.triggers.TimerTrigger$TimerTriggerCause') + +} diff --git a/vars/startedByUser.groovy b/vars/startedByUser.groovy new file mode 100644 index 000000000..cfa8f6558 --- /dev/null +++ b/vars/startedByUser.groovy @@ -0,0 +1,11 @@ +// vars/startedByUser.groovy + +/** + * Return True if the build was caused by a User (I.e. Build Now) + */ +Boolean call(Map config = [:]) { + + /* groovylint-disable-next-line UnnecessaryGetter */ + return currentBuild.getBuildCauses().toString().contains('hudson.model.Cause$UserIdCause') + +}