mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 16:26:14 +08:00
jenkins: simplify timer check (#32254)
simplify timer check old-commit-hash: 0d5dd25db51b01486933a5f1299ccac26521d89d
This commit is contained in:
Vendored
+2
-19
@@ -9,26 +9,9 @@ def retryWithDelay(int maxRetries, int delay, Closure body) {
|
||||
throw Exception("Failed after ${maxRetries} retries")
|
||||
}
|
||||
|
||||
// check if started by timer: https://stackoverflow.com/questions/43516025/how-to-handle-nightly-build-in-jenkins-declarative-pipeline
|
||||
@NonCPS
|
||||
// check if started by timer: https://gist.github.com/aaclarker/75b8a0eb2b4d600779f84f8e849f2c37
|
||||
def isJobStartedByTimer() {
|
||||
def startedByTimer = false
|
||||
try {
|
||||
def buildCauses = currentBuild.rawBuild.getCauses()
|
||||
for ( buildCause in buildCauses ) {
|
||||
if (buildCause != null) {
|
||||
def causeDescription = buildCause.getShortDescription()
|
||||
echo "shortDescription: ${causeDescription}"
|
||||
if (causeDescription.contains("Started by timer")) {
|
||||
startedByTimer = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(theError) {
|
||||
echo "Error getting build cause"
|
||||
}
|
||||
|
||||
return startedByTimer
|
||||
return currentBuild.getBuildCauses()[0]["shortDescription"].matches("Started by timer");
|
||||
}
|
||||
|
||||
def device(String ip, String step_label, String cmd) {
|
||||
|
||||
Reference in New Issue
Block a user