From 796f1c60f3a84c1f5a3e7ed2e4c6fde11b8b6bce Mon Sep 17 00:00:00 2001 From: Tiago Espinha Date: Wed, 3 Sep 2025 12:21:51 +0100 Subject: [PATCH] Disable automatic test file validation and add validate button. Automatic test file validation causes issues when workspaces have large O(millions) amount of files. In those cases, if the particular test file doesn't exist at the time the user looks at the configuration page, the Agent will start crawling the whole workspace looking for other subdirectories where that file might be. By doing so, it's tracking all the files it's seen which eventually leads to filling up the heap and crashing. This disables the automatic file validation and adds a button that makes it possible to validate manually. --- src/main/java/hudson/tasks/junit/JUnitResultArchiver.java | 5 +++-- .../hudson/tasks/junit/JUnitResultArchiver/config.jelly | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java b/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java index 2051c9e9a..a50d255e7 100644 --- a/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java +++ b/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java @@ -554,12 +554,13 @@ public String getDisplayName() { * @return the validation result. * @throws IOException if an error occurs. */ - public FormValidation doCheckTestResults(@AncestorInPath AbstractProject project, @QueryParameter String value) + public FormValidation doValidateTestResults( + @AncestorInPath AbstractProject project, @QueryParameter("testResults") String testResults) throws IOException { if (project == null || !project.hasPermission(Item.WORKSPACE)) { return FormValidation.ok(); } - return FilePath.validateFileMask(project.getSomeWorkspace(), value); + return FilePath.validateFileMask(project.getSomeWorkspace(), testResults); } @Override diff --git a/src/main/resources/hudson/tasks/junit/JUnitResultArchiver/config.jelly b/src/main/resources/hudson/tasks/junit/JUnitResultArchiver/config.jelly index 8a5024c18..37e078b43 100644 --- a/src/main/resources/hudson/tasks/junit/JUnitResultArchiver/config.jelly +++ b/src/main/resources/hudson/tasks/junit/JUnitResultArchiver/config.jelly @@ -29,6 +29,10 @@ THE SOFTWARE. + + ${%Note: Validation is optional. Only use the validate button in small workspaces to avoid memory issues.} + +