Skip to content

Commit 14f773d

Browse files
committed
Add Simulate-timed-job pragma
Skip-checkpatch: true Skip-build: true Quick-build: true Skip-unit-tests: true Signed-off-by: Brian J. Murrell <brian.murrell@intel.com> Skip-test: true
1 parent 18b8d21 commit 14f773d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vars/startedByTimer.groovy

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* groovylint-disable VariableName */
12
// vars/startedByTimer.groovy
23

34
/**
@@ -6,8 +7,16 @@
67
* This needs to be here rather than in pipeline-lib or Jenkinsfile due to
78
* Scripts not permitted to use method net.sf.json.JSON isEmpty.
89
*/
9-
Boolean call(Map config = [:]) {
10+
Boolean call() {
1011

11-
return !currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').isEmpty()
12+
Boolean simulate_timed_job = cachedCommitPragma('Simulate-timed-job') == 'true'
13+
14+
if (simulate_timed_job) {
15+
println('Simulating timed job behaviour')
16+
}
17+
18+
return simulate_timed_job ||
19+
/* groovylint-disable-next-line UnnecessaryGetter */
20+
!currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').isEmpty()
1221

1322
}

0 commit comments

Comments
 (0)