From dd7d37b8e4163e7b72b7a56c0c735028b307b244 Mon Sep 17 00:00:00 2001
From: Martin Weinelt <martin@darmstadt.freifunk.net>
Date: Sun, 26 Apr 2020 02:24:43 +0200
Subject: [PATCH] Jenkinsfile: add timeout to build and test steps

This will hopefully make CI runs more robust and recover stale workers.
---
 contrib/ci/Jenkinsfile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/ci/Jenkinsfile b/contrib/ci/Jenkinsfile
index 0deb5fcdb..e4c3b4441 100644
--- a/contrib/ci/Jenkinsfile
+++ b/contrib/ci/Jenkinsfile
@@ -37,7 +37,9 @@ pipeline {
 				sh label: 'Identify runner', script: 'echo $SLAVE_NAME'
 				sh 'make update'
 				sh 'test -d /dl_cache && ln -s /dl_cache openwrt/dl || true'
-				sh 'make -j$(nproc) V=s'
+				timeout(time: 2, unit: "HOURS") {
+					sh 'make -j$(nproc) V=s'
+				}
 				stash includes: '**/output/images/factory/*-x86-64.img.gz', name: 'gluon-x86-64-factory'
 			}
 		}
@@ -53,7 +55,9 @@ pipeline {
 				sh label: 'Print python environment', script: 'python3 -m pip freeze'
 				script {
 					for (f in findFiles(glob: 'tests/*.py')) {
-						sh label: "Test ${f.name}", script: "python3 tests/${f.name} --use-tmp-workdir"
+						timeout(time: 10, unit: "MINUTES") {
+							sh label: "Test ${f.name}", script: "python3 tests/${f.name} --use-tmp-workdir"
+						}
 					}
 				}
 			}
-- 
GitLab