Handle attachments from the "same" test from different branches/nodes#203
Merged
jonesbusy merged 6 commits intojenkinsci:mainfrom Feb 24, 2026
Merged
Handle attachments from the "same" test from different branches/nodes#203jonesbusy merged 6 commits intojenkinsci:mainfrom
jonesbusy merged 6 commits intojenkinsci:mainfrom
Conversation
Use SuiteResult.getEnclosingBlocks() to namespace attachment storage paths and filter Data.getTestAction() by matching enclosing flow node IDs, so that parallel pipeline branches with the same test don't overwrite each other's attachments or produce duplicate actions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jtnord
commented
Feb 24, 2026
src/main/java/hudson/plugins/junitattachments/GetTestDataMethodObject.java
Show resolved
Hide resolved
jtnord
commented
Feb 24, 2026
src/main/java/hudson/plugins/junitattachments/GetTestDataMethodObject.java
Show resolved
Hide resolved
jtnord
commented
Feb 24, 2026
src/main/java/hudson/plugins/junitattachments/TestClassAttachmentTestAction.java
Show resolved
Hide resolved
jtnord
commented
Feb 24, 2026
…ableList) @jglick warns against using imutable lists in serialisation.
There was a problem hiding this comment.
Pull request overview
This PR fixes attachment collisions when the same test (same attachment paths) is executed multiple times in different Pipeline branches/nodes by namespacing attachment storage/actions using the test suites’ enclosing flow blocks.
Changes:
- Namespace attachment storage per flow (enclosing blocks) and pass that context through
AttachmentPublisher.Data. - Filter/partition
TestActionrendering by enclosing blocks and disambiguate class-level action URL names. - Add Pipeline regression tests covering parallel-branch executions and class-result attachment rendering.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/main/java/hudson/plugins/junitattachments/AttachmentPublisher.java |
Propagates/enforces enclosing-block scoping for actions and attachment root resolution. |
src/main/java/hudson/plugins/junitattachments/GetTestDataMethodObject.java |
Derives enclosing blocks from suites and namespaces attachment storage path accordingly. |
src/main/java/hudson/plugins/junitattachments/TestClassAttachmentTestAction.java |
Disambiguates class attachment action URL name and updates URL generation to use it. |
src/test/java/hudson/plugins/junitattachments/AttachmentPublisherPipelineTest.java |
Adds regression tests for parallel branches and updates URL/content fetching helper logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/hudson/plugins/junitattachments/AttachmentPublisherPipelineTest.java
Show resolved
Hide resolved
src/test/java/hudson/plugins/junitattachments/AttachmentPublisherPipelineTest.java
Show resolved
Hide resolved
src/test/java/hudson/plugins/junitattachments/AttachmentPublisherPipelineTest.java
Outdated
Show resolved
Hide resolved
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the same test was recorded with the same attachment paths (but on different nodes) then wen viewing test results you would only be able to see one of the attachments.
The testData now records the flow ids so that attachments from different flows can be disambiguated.
Also tested interactively by:
fixes: #202
Testing done
Submitter checklist