This is an automated email from the ASF dual-hosted git repository.

benweidig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/master by this push:
     new 01336b071 TAP5-2819: Jenkinsfile fix cell-based artifact archiving
01336b071 is described below

commit 01336b07143133b6723365694690913a593ff366
Author: Ben Weidig <[email protected]>
AuthorDate: Sat Apr 18 16:53:44 2026 +0200

    TAP5-2819: Jenkinsfile fix cell-based artifact archiving
---
 Jenkinsfile | 57 ++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index c3689bff7..38b36f113 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -44,33 +44,44 @@ pipeline {
 
                     stage('Test: Check') {
                         steps {
-                            // This will run unit tests and the default 
integration variant (jQuery + RequireJS).
-                            // We include the coverage report in this step, as 
modifying the test results with
-                            // sed would trigger a test rerun if it would be 
its own stage.
+                            // This will run unit tests (JUnit & TestNG) and 
the default integration variant (jQuery + RequireJS).
                             sh './gradlew check combinedJacocoReport 
--continue'
                         }
                         post {
                             always {
-                                // JUnit runs inside a matrix cell, so Jenkins 
automatically scopes the results
-                                junit(
-                                    testResults: 
"**/build/test-results/**/*.xml",
-                                    allowEmptyResults: true
-                                )
-
-                                // archiveArtifacts has no per-cell 
namespacing, so we copy them into a
-                                // JDK-named folder first to avoid cells 
overwriting each other
-                                sh """
-                                    find . \\( -path '*/build/reports' -o 
-path '*/build/test-results' \\) \
-                                        -not -path 
'./build/matrix-artifacts/*' -type d | while IFS= read -r src; do
-                                        
dest="build/matrix-artifacts/${JDK_VERSION}/\${src#./}"
-                                        mkdir -p -- "\$dest"
-                                        cp -r -- "\$src/." "\$dest/"
-                                    done
-                                """
-                                archiveArtifacts(
-                                    artifacts: 
"build/matrix-artifacts/${JDK_VERSION}/**/*",
-                                    allowEmptyArchive: true
-                                )
+                                script {
+                                    // Define a clean, unique destination for 
this cell
+                                    def cellArtifactPath = 
"build/matrix-artifacts/${JDK_VERSION}"
+
+                                    sh """
+                                        # Remove any old artifacts from 
previous runs on this same node
+                                        rm -rf -- "${cellArtifactPath}"
+                                        mkdir -p -- "${cellArtifactPath}"
+
+                                        # Find all test results and reports, 
but EXCLUDE our own destination.
+                                        # We use -mindepth to ensure we don't 
pick up the root accidentally.
+                                        find . -mindepth 2 \\( -path 
'*/build/reports' -o -path '*/build/test-results' \\) \
+                                            -not -path '*/matrix-artifacts/*' 
-type d | while read -r src; do
+                                            # Create a path-based destination 
name to avoid collisions
+                                            rel_src=\${src#./}
+                                            
dest_dir="${cellArtifactPath}/\${rel_src}"
+                                            mkdir -p -- "\$dest_dir"
+                                            cp -r -- "\$src/." "\$dest_dir/"
+                                        done
+                                    """
+
+                                    // Point JUnit ONLY to the namespaced 
folder for this specific matrix cell
+                                    junit(
+                                        testResults: 
"${cellArtifactPath}/**/test-results/**/*.xml",
+                                        allowEmptyResults: true
+                                    )
+
+                                    // Archive only the namespaced artifacts
+                                    archiveArtifacts(
+                                        artifacts: "${cellArtifactPath}/**/*",
+                                        allowEmptyArchive: true
+                                    )
+                                }
                             }
                         }
                     }

Reply via email to