Skip to content

Commit a4c0a8f

Browse files
committed
test(ci): match the daemon restore step inside the wrapped post block
9f26f16 wrapped the Jenkinsfile post/always restore step in script { try { sh ... } finally { cleanWs(...) } } so workspaces are cleaned after every build. tests/test_jenkins_daemon_recovery.py, which the pipeline runs as its first step, still expected sh to follow always { directly. Its regex therefore found nothing, and every Jenkins build since then failed before any other stage ran. Allow wrapper content before the first sh step inside always { }. The test still extracts and runs the real restore script against its mock CLI.
1 parent 1224b2b commit a4c0a8f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/test_jenkins_daemon_recovery.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
pipeline = (Path(__file__).resolve().parents[1] / "Jenkinsfile").read_text()
1111
stop = re.search(r"stage\('Stop active CBM daemon'\).*?sh '''(.*?)'''", pipeline, re.S).group(1)
12-
restore = re.search(r"post\s*\{\s*always\s*\{\s*sh '''(.*?)'''", pipeline, re.S).group(1)
12+
# The always block may wrap the restore step (script/try for cleanWs), so allow
13+
# any content before the first sh step inside it.
14+
restore = re.search(r"post\s*\{\s*always\s*\{.*?sh '''(.*?)'''", pipeline, re.S).group(1)
1315

1416
with tempfile.TemporaryDirectory() as directory:
1517
root = Path(directory)

0 commit comments

Comments
 (0)