code-coverage-api-plugin: IllegalStateException: Duplicate Key Error After Updating to 3.0.4
Jenkins and plugins versions report
Environment
Jenkins: 2.346.2
OS: Linux - 5.13.0-1031-aws
---
ace-editor:1.1
ant:475.vf34069fef73c
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk-ec2:1.12.246-349.v96b_b_f7eb_a_c3c
aws-java-sdk-minimal:1.12.246-349.v96b_b_f7eb_a_c3c
bootstrap4-api:4.6.0-5
bootstrap5-api:5.1.3-7
bouncycastle-api:2.26
branch-api:2.1046.v0ca_37783ecc5
build-timeout:1.21
built-on-column:1.1
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.7.4
cloudbees-folder:6.729.v2b_9d1a_74d673
code-coverage-api:2.0.4
command-launcher:84.v4a_97f2027398
conditional-buildstep:1.4.2
config-file-provider:3.8.2
credentials:1139.veb_9579fca_33b_
credentials-binding:1.27.1
data-tables-api:1.12.1-2
dependencyanalyzer:0.7
disk-usage:0.28
display-url-api:2.3.6
docker-commons:1.19
docker-workflow:1.28
durable-task:496.va67c6f9eefa7
ec2:1.68
echarts-api:5.3.3-1
email-ext:2.87
envinject:2.866.v5c0403e3d4df
envinject-api:1.199.v3ce31253ed13
extended-choice-parameter:346.vd87693c5a_86c
extended-read-permission:3.2
external-monitor-job:191.v363d0d1efdf8
font-awesome-api:6.1.1-1
forensics-api:1.15.1
git:4.11.3
git-client:3.11.0
git-forensics:1.8.0
git-parameter:0.9.14
git-server:1.11
github:1.34.3
github-api:1.303-400.v35c2d8258028
github-branch-source:2.11.4
global-slack-notifier:1.5
gradle:1.39.4
handlebars:3.0.8
jackson2-api:2.13.3-285.vc03c0256d517
jacoco:3.3.2
javadoc:217.v905b_86277a_2a_
javax-activation-api:1.2.0-3
javax-mail-api:1.6.2-6
jaxb:2.3.6-1
jdk-tool:1.5
jenkins-multijob-plugin:1.36
jjwt-api:0.11.5-77.v646c772fddb_0
jquery:1.12.4-1
jquery3-api:3.6.0-4
jsch:0.1.55.2
junit:1119.1121.vc43d0fc45561
ldap:2.10
lockable-resources:2.15
login-theme:1.1
m2release:0.16.3
mailer:414.vcc4c33714601
material-theme:0.4.1
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.16
mina-sshd-api-common:2.8.0-30.vf9df64641cb_d
mina-sshd-api-core:2.8.0-30.vf9df64641cb_d
momentjs:1.1.1
multiselect-parameter:1.4
nexus-artifact-uploader:2.13
node-iterator-api:1.5.1
nodejs:1.5.1
okhttp-api:4.9.3-105.vb96869f8ac3a
pam-auth:1.8
parameterized-trigger:2.45
pipeline-build-step:2.18
pipeline-github-lib:38.v445716ea_edda_
pipeline-graph-analysis:1.11
pipeline-groovy-lib:593.va_a_fc25d520e9
pipeline-input-step:449.v77f0e8b_845c4
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2097.v33db_b_de764b_e
pipeline-model-definition:1.9.3
pipeline-model-extensions:1.9.3
pipeline-rest-api:2.24
pipeline-stage-step:293.v200037eefcd5
pipeline-stage-tags-metadata:2.2097.v33db_b_de764b_e
pipeline-stage-view:2.24
pipeline-utility-steps:2.13.0
plain-credentials:1.8
plugin-util-api:2.17.0
popper-api:1.16.1-3
popper2-api:2.11.5-2
preSCMbuildstep:0.3
prism-api:1.28.0-2
pyenv:0.0.7
pyenv-pipeline:2.1.2
readonly-parameters:1.0.0
resource-disposer:0.19
role-strategy:530.ved5445d4875a_
ruby-runtime:0.12
run-condition:1.5
saml:2.298.vc7a_2b_3958628
scm-api:608.vfa_f971c5a_a_e9
script-security:1175.v4b_d517d6db_f0
shiningpanda:0.24
simple-theme-plugin:103.va_161d09c38c7
slack:616.v03b_1e98d13dd
slack-uploader:1.7
snakeyaml-api:1.30.2-76.vc104f7ce9870
ssh-credentials:291.v8211e4f8efb_c
ssh-slaves:1.806.v2253cedd3295
sshd:3.242.va_db_9da_b_26a_c3
structs:318.va_f3ccb_729b_71
terraform:1.0.10
theme-manager:1.4
timestamper:1.18
token-macro:293.v283932a_0a_b_49
trilead-api:1.67.vc3938a_35172f
uno-choice:2.6.3
variant:1.4
windows-slaves:1.8.1
workflow-aggregator:578.vf9a_f99755f4a_
workflow-api:1188.v0016b_4f29881
workflow-basic-steps:969.vc4ec3e4854b_f
workflow-cps:2746.v0da_83a_332669
workflow-cps-global-lib:588.v576c103a_ff86
workflow-durable-task-step:1174.v73a_9a_17edce0
workflow-job:1207.ve6191ff089f8
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:625.vd896b_f445a_f8
workflow-support:833.va_1c71061486b_
ws-cleanup:0.42
What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu 20.04
Reproduction steps
- Using Code Coverage Plugin 3.0.4
- Execute this stage after using Maven to build a Java project that generates JaCoCo reports
stage('Coverage Report') {
steps {
discoverGitReferenceBuild()
publishCoverage(
adapters: [
jacocoAdapter(
path: '**/jacoco.xml'
)
],
calculateDiffForChangeRequests: true,
failBuildIfCoverageDecreasedInChangeRequest: true,
failNoReports: true,
skipPublishingChecks: true,
sourceFileResolver: sourceFiles('NEVER_STORE')
)
}
}
Expected Results
Stage should complete successfully with coverage data being reported in the Jenkins UI
Actual Results
The job fails with this error. NOTE: The specific file varies, but it is always a file with a name that exists multiple times within the repository (in different sub directories).
java.lang.IllegalStateException: Duplicate key [File] JettyConfig.java
at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
at java.util.HashMap.merge(HashMap.java:1255)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
at io.jenkins.plugins.coverage.model.FileChangesProcessor.attachChangedCodeLines(FileChangesProcessor.java:41)
at io.jenkins.plugins.coverage.model.CoverageReporter.run(CoverageReporter.java:101)
at io.jenkins.plugins.coverage.CoverageProcessor.performCoverageReport(CoverageProcessor.java:133)
at io.jenkins.plugins.coverage.CoveragePublisher.perform(CoveragePublisher.java:114)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Anything else?
This started happening after we upgraded to version 3.0.4 of the plugin. Downgrading to 2.0.4 resolves the problem.
It seems to be an issue related to duplicate filenames within the repository even though the files are in different directories.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (8 by maintainers)
Commits related to this issue
- Merge pull request #445 from fo-code/unique-path-validation [#433] Remove duplicate file nodes — committed to jenkinsci/code-coverage-api-plugin by uhafner 2 years ago
This makes sense. Thank you much for the detailed information!
I agree that logging and skipping these problematic files is a good and reasonable immediate solution.
Also agree that we should adjust our code structure to have unique package naming. I’m not sure when/if this will happen, but we can look at doing this if other longer term solutions don’t work out.