jenkinsci / jenkinsci/ctrf-json-plugin
Writing the JUnit XML file fails on remote build nodes
- Dominant language
- Java
- Stars
- 5
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### Jenkins and plugins versions report
Environment
```text
Jenkins: 2.452.1
OS: Linux - 4.15.0-213-generic
Java: 11.0.19 - Ubuntu (OpenJDK 64-Bit Server VM)
---
all-changes:1.5
analysis-model-api:12.3.3
ansicolor:1.0.4
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.3.1-110.v77252fb_d4da_5
asm-api:9.7-33.v4d23ef79fcc8
authentication-tokens:1.119.v50285141b_7e1
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1169.va_f810c56e895
build-monitor-plugin:1.14-883.vf620a_44eb_ec1
build-name-setter:2.4.3
build-with-parameters:76.v9382db_f78962
caffeine-api:3.1.8-133.v17b_1ff2e0599
categorized-view:1.13
checks-api:2.2.0
cloudbees-disk-usage-simple:203.v3f46a_7462b_1a_
cloudbees-folder:6.928.v7c780211d66e
command-launcher:107.v773860566e2e
commons-compress-api:1.26.1-2
commons-lang3-api:3.14.0-76.vda_5591261cfe
commons-text-api:1.12.0-119.v73ef73f2345d
config-file-provider:973.vb_a_80ecb_9a_4d0
configuration-as-code:1810.v9b_c30a_249a_4c
coverage:1.16.1
credentials:1371.vfee6b_095f0a_3
credentials-binding:681.vf91669a_32e45
cron_column:1.7
ctrf-json:36.vb_8c67b_f1dc07
dark-theme:439.vdef09f81f85e
dashboard-view:2.508.va_74654f026d1
data-tables-api:2.0.8-1
display-url-api:2.204.vf6fddd8a_8b_e9
dtkit-api:3.0.2
durable-task:555.v6802fe0f0b_82
echarts-api:5.5.0-1
eddsa-api:0.3.0-4.v84c6f0f4969e
email-ext:1814.v404722f34263
enhanced-old-build-discarder:1.4
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
external-monitor-job:215.v2e88e894db_f8
font-awesome-api:6.5.2-1
forensics-api:2.4.0
gerrit-code-review:0.4.9
gerrit-trigger:2.41.1
git:5.2.2
git-client:5.0.0
git-parameter:0.9.19
git-server:126.v0d945d8d2b_39
gradle:2.12
gson-api:2.11.0-41.v019fcf6125dc
htmlpublisher:1.35
instance-identity:185.v303dc7c645f9
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:73.vddf737284550
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
jnr-posix-api:3.1.19-2
joda-time-api:2.12.7-29.v5a_b_e3a_82269a_
jquery:1.12.4-1
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20240303-41.v94e11e6de726
json-path-api:2.9.0-58.v62e3e85b_a_655
junit:1265.v65b_14fa_f12f0
ldap:725.v3cb_b_711b_1a_ef
libvirt-slave:286.vc21fa_98f531c
list-git-branches-parameter:0.0.13
mailer:472.vf7c289a_4b_420
mapdb-api:1.0.9-40.v58107308b_7a_7
matrix-auth:3.2.2
matrix-combinations-parameter:1.3.3
matrix-project:832.va_66e270d2946
metrics:4.2.21-451.vd51df8df52ec
mina-sshd-api-common:2.13.1-117.v2f1a_b_66ff91d
mina-sshd-api-core:2.13.1-117.v2f1a_b_66ff91d
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.11
parameterized-trigger:806.vf6fff3e28c3e
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github-lib:61.v629f2cc41d83
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-groovy-lib:727.ve832a_9244dfa_
pipeline-input-step:495.ve9c153f6067b_
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2205.vc9522a_9d5711
pipeline-model-definition:2.2205.vc9522a_9d5711
pipeline-model-extensions:2.2205.vc9522a_9d5711
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2205.vc9522a_9d5711
pipeline-stage-view:2.34
pipeline-utility-steps:2.17.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-usage-plugin:4.5
plugin-util-api:4.1.0
prism-api:1.29.0-15
prometheus:773.v3b_62d8178eec
pyenv-pipeline:2.1.2
regexemail:0.3
resource-disposer:0.23
robot:3.5.2
run-condition:1.7
scm-api:690.vfc8b_54395023
script-security:1341.va_2819b_414686
simple-theme-plugin:191.vcd207ef9dd24
slave-status:56.v1798df8ff586
slave-utilization-plugin:1.8
snakeyaml-api:2.2-111.vc6598e30cc65
ssh-agent:367.vf9076cd4ee21
ssh-credentials:337.v395d2403ccd4
ssh-slaves:2.973.v0fa_8c0dea_f9f
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
theme-manager:262.vc57ee4a_eda_5d
throttle-concurrents:2.14
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.147.vb_73cc728a_32e
uno-choice:2.8.3
variant:60.v7290fc0eb_b_cd
view-job-filters:382.vdf2d5e3f02f0
warnings-ng:11.3.0
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1316.v33eb_726c50b_a_
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:3908.vd6b_b_5a_a_54010
workflow-durable-task-step:1360.v82d13453da_a_f
workflow-job:1400.v7fd111b_ec82f
workflow-multibranch:783.787.v50539468395f
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:678.v3ee58b_469476
workflow-support:920.v59f71ce16f04
ws-cleanup:0.46
xunit:3.1.4
```
### What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu Focal, Jammy, Noble
### Reproduction steps
We committed to CTRF as the output format for internal software testing to enable postprocessing into custom test reports. To get used to CTRF, we installed the plugin in Jenkins (v 2.452.1) and created a freestyle job that echoes JSON into a file which then gets processed by the CTRF plugin. Running the job on the built-in executor works perfectly fine. Running the job on a remote build node results in a `FileNotFoundException`:
```
Processing JSON report: /path/to/workspace/check_ctrf_nightly/report.json
Failed to process JSON file: /path/to/workspace/check_ctrf_nightly/report.json: /path/to/workspace/check_ctrf_nightly/junitResult-report.json.xml (No such file or directory)
java.io.FileNotFoundException: /path/to/workspace/check_ctrf_nightly/junitResult-report.json.xml (No such file or directory)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:126)
at io.jenkins.plugins.PublishCtrfJson.PublishCtrfJson.convertToJUnitXMLFormatAndWrite(PublishCtrfJson.java:201)
at io.jenkins.plugins.PublishCtrfJson.PublishCtrfJson.perform(PublishCtrfJson.java:94)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:767)
at hudson.model.Build$BuildExecution.post2(Build.java:179)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:711)
at hudson.model.Run.execute(Run.java:1917)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Build step 'Publish CTRF test result report' changed build result to FAILURE
Finished: FAILURE
```
It seems like the code at https://github.com/jenkinsci/ctrf-json-plugin/blob/main/src/main/java/io/jenkins/plugins/PublishCtrfJson/PublishCtrfJson.java#L201 is not able to write the JUnit XML file into the workspace directory. We tried different controllers and different build nodes running on a variety of Ubuntu versions (see above). All remote executions fail while executions on built-in always succeed. The combinations are as follows, where the Jenkins controller always runs on Ubuntu Focal with openjdk 11.0.19:
- built-in executor: success
- remote executor running on Ubuntu Jammy with openjdk 11.0.25: failure
- remote executor running on Ubuntu Jammy with openjdk 17.0.13: failure
- remote executor running on Ubuntu Noble with openjdk 21.0.5: failure
We are unable to detect why the `FileNotFoundException` gets thrown because we don't see any further details in the stack trace or in logs (apparently nothing gets logged on the remote build nodes).
### Expected Results
The CTRF JSON file gets processed and the results are shown in Jenkins
### Actual Results
The file only gets processed when a built-in executor is used. Processing fails when a remote executor is used.
### Anything else?
We would be grateful for any hint on how to use the plugin in combination with a remote build node.
### Are you interested in contributing a fix?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.