Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bmurrell/skip-build-on-timed-runs #325

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions vars/daosPackagesVersion.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion vars/daosRepos.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}

Expand Down
1 change: 1 addition & 0 deletions vars/provisionNodes.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 6 additions & 1 deletion vars/skipStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -161,27 +162,31 @@ 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":
return paramsValue('CI_RPM_el8_NOBUILD', false) ||
(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) ||
target_branch == 'weekly-testing' ||
(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) ||
target_branch == 'weekly-testing' ||
(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":
Expand Down
19 changes: 19 additions & 0 deletions vars/startedByTimer.groovy
Original file line number Diff line number Diff line change
@@ -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')

}
11 changes: 11 additions & 0 deletions vars/startedByUser.groovy
Original file line number Diff line number Diff line change
@@ -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')

}