jenkinsci / code-coverage-api-plugin

Deprecated Jenkins Code Coverage Plugin
https://plugins.jenkins.io/code-coverage-api/
MIT License
112 stars 75 forks source link

Duplicate key ... (attempted merging values [File] Conventions.java and [File] Layouts.java) #467

Closed timja closed 2 years ago

timja commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.361.1 OS: Linux - 5.4.0-1090-azure --- ace-editor:1.1 analysis-model-api:10.16.1 ansicolor:1.0.2 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 authentication-tokens:1.4 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-cloudformation:1.12.287-357.vf82d85a_6eefd aws-java-sdk-codebuild:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ec2:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecr:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-efs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-elasticbeanstalk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-iam:1.12.287-357.vf82d85a_6eefd aws-java-sdk-logs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-minimal:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sns:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sqs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ssm:1.12.287-357.vf82d85a_6eefd azure-container-agents:241.va_780fa_dc374a_ azure-credentials:216.ve0b_4a_485ffc2 azure-sdk:118.v43f74dd9ca_dc azure-vm-agents:822.v3a18fc3d2de1 basic-branch-build-strategies:1.3.2 beer:34.v27fe279176a_4 blueocean:1.25.8 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.25.8 blueocean-commons:1.25.8 blueocean-config:1.25.8 blueocean-core-js:1.25.8 blueocean-dashboard:1.25.8 blueocean-display-url:2.4.1 blueocean-events:1.25.8 blueocean-git-pipeline:1.25.8 blueocean-github-pipeline:1.25.8 blueocean-i18n:1.25.8 blueocean-jira:1.25.8 blueocean-jwt:1.25.8 blueocean-personalization:1.25.8 blueocean-pipeline-api-impl:1.25.8 blueocean-pipeline-editor:1.25.8 blueocean-pipeline-scm-api:1.25.8 blueocean-rest:1.25.8 blueocean-rest-impl:1.25.8 blueocean-web:1.25.8 bootstrap4-api:4.6.0-5 bootstrap5-api:5.2.0-3 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-timeout:1.24 buildtriggerbadge:251.vdf6ef853f3f5 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.5 cloud-stats:0.27 cloudbees-bitbucket-branch-source:791.vb_eea_a_476405b cloudbees-folder:6.758.vfd75d09eea_a_1 code-coverage-api:3.1.0 command-launcher:84.v4a_97f2027398 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.9-19.v8df45c678366 conditional-buildstep:1.4.2 configuration-as-code:1512.vb_79d418d5fc8 copyartifact:1.47 credentials:1143.vb_e8b_b_ceee347 credentials-binding:523.vd859a_4b_122e6 cvs:2.19.1 dark-theme:245.vb_a_2b_b_010ea_96 data-tables-api:1.12.1-3 disable-github-multibranch-status:1.2 display-url-api:2.3.6 docker-commons:1.21 docker-workflow:521.v1a_a_dd2073b_2e durable-task:500.v8927d9fd99d8 ec2:2.0.2 echarts-api:5.3.3-1 embeddable-build-status:255.va_d2370ee8fde extended-read-permission:3.2 external-monitor-job:192.ve979ca_8b_3ccd favorite:2.4.1 font-awesome-api:6.1.2-1 forensics-api:1.15.1 git:4.11.5 git-client:3.11.2 git-forensics:1.9.0 github:1.35.0 github-api:1.303-400.v35c2d8258028 github-branch-source:1694.vd46793a_c4a_57 github-checks:1.0.19 groovy:442.v817e6d937d6c handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.30 http_request:1.16 instance-identity:116.vf8f487400980 ionicons-api:24.va_745a_b_a_97fc3 jackson2-api:2.13.3-285.vc03c0256d517 jacoco:3.3.2 jakarta-activation-api:2.0.1-1 jakarta-mail-api:2.0.1-1 javadoc:226.v71211feb_e7e9 javax-activation-api:1.2.0-4 javax-mail-api:1.6.2-7 jaxb:2.3.6-1 jdk-tool:55.v1b_32b_6ca_f9ca jenkins-design-language:1.25.8 jersey2-api:2.37-1 jira:3.8 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.15-1 jobConfigHistory:1171.v04b_66d78555e jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.6.0-4 jsch:0.1.55.61.va_e9ee26616e7 junit:1119.1121.vc43d0fc45561 junit-attachments:101.v82f494a_00e9e junit-realtime-test-reporter:90.v7dc2c937f9a_8 keyboard-shortcuts-plugin:1.4 kubernetes:3704.va_08f0206b_95e kubernetes-client-api:5.12.2-193.v26a_6078f65a_9 kubernetes-credentials:0.9.0 ldap:2.12 lockable-resources:2.16 mailer:438.v02c7f0a_12fa_4 mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.1.5 matrix-project:785.v06b_7f47b_c631 maven-plugin:3.19 mercurial:1251.va_b_121f184902 metrics:4.2.10-389.v93143621b_050 mina-sshd-api-common:2.8.0-36.v8e25ce90d4b_1 mina-sshd-api-core:2.8.0-36.v8e25ce90d4b_1 momentjs:1.1.1 node-iterator-api:49.v58a_8b_35f8363 okhttp-api:4.9.3-108.v0feda04578cf pam-auth:1.10 parallel-test-executor:318.va_e768e2e32e3 parameterized-trigger:2.45 pipeline-build-step:2.18 pipeline-github-lib:38.v445716ea_edda_ pipeline-githubnotify-step:49.vf37bf92d2bc8 pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-graph-view:51.v5a693b766483 pipeline-groovy-lib:612.v84da_9c54906d pipeline-input-step:449.v77f0e8b_845c4 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2114.v2654ca_721309 pipeline-model-definition:2.2114.v2654ca_721309 pipeline-model-extensions:2.2114.v2654ca_721309 pipeline-rest-api:2.24 pipeline-stage-step:296.v5f6908f017a_5 pipeline-stage-tags-metadata:2.2114.v2654ca_721309 pipeline-stage-view:2.24 pipeline-utility-steps:2.13.0 plain-credentials:139.ved2b_9cf7587b plugin-util-api:2.17.0 popper-api:1.16.1-3 popper2-api:2.11.6-1 prism-api:1.28.0-2 pubsub-light:1.17 run-condition:1.5 scm-api:621.vda_a_b_055e58f7 script-security:1175.v4b_d517d6db_f0 snakeyaml-api:1.31-84.ve43da_fb_49d0b sse-gateway:1.26 ssh-agent:295.v9ca_a_1c7cc3a_a_ ssh-credentials:305.v8f4381501156 ssh-slaves:1.834.v622da_57f702c sshd:3.249.v2dc2ea_416e33 structs:324.va_f5d6774f3a_d subversion:2.16.0 support-core:1206.v14049fa_b_d860 theme-manager:1.5 throttle-concurrents:2.9 timestamper:1.19 token-macro:308.v4f2b_ed62b_b_16 toolenv:1.2 translation:1.16 trilead-api:2.72.v2a_3236754f73 variant:59.vf075fe829ccb warnings-ng:9.19.1 windows-azure-storage:378.vb2cb9797e1e5 windows-slaves:1.8.1 workflow-aggregator:590.v6a_d052e5a_a_b_5 workflow-api:1192.v2d0deb_19d212 workflow-basic-steps:994.vd57e3ca_46d24 workflow-cps:2759.v87459c4eea_ca_ workflow-durable-task-step:1201.vb_0a_ea_ca_96d6c workflow-job:1232.v5a_4c994312f1 workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:838.va_3a_087b_4055b ```

What Operating System are you using (both controller, and any agents involved in the problem)?

ci.jenkins.io

Reproduction steps

Run this pipeline https://github.com/jenkinsci/design-library-plugin/pull/90

as of commit 2796bb89ac793bb1775a6dff1a48b52ca34c0f67

Expected Results

No error

Actual Results

https://github.com/jenkinsci/design-library-plugin/pull/90/checks?check_run_id=8226613977

Duplicate key io/jenkins/plugins/designlibrary/Conventions.java (attempted merging values [File] Conventions.java and [File] Layouts.java)
12:11:02  java.lang.IllegalStateException: Duplicate key io/jenkins/plugins/designlibrary/Conventions.java (attempted merging values [File] Conventions.java and [File] Layouts.java)
12:11:02    at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
12:11:02    at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
12:11:02    at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
12:11:02    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
12:11:02    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
12:11:02    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
12:11:02    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
12:11:02    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
12:11:02    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
12:11:02    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
12:11:02    at io.jenkins.plugins.coverage.model.FileChangesProcessor.getFileNodeMappingWithReferencePaths(FileChangesProcessor.java:290)
12:11:02    at io.jenkins.plugins.coverage.model.FileChangesProcessor.attachIndirectCoveragesChanges(FileChangesProcessor.java:121)
12:11:02    at io.jenkins.plugins.coverage.model.CoverageReporter.run(CoverageReporter.java:105)
12:11:02    at io.jenkins.plugins.coverage.CoverageProcessor.performCoverageReport(CoverageProcessor.java:133)
12:11:02    at io.jenkins.plugins.coverage.CoveragePublisher.perform(CoveragePublisher.java:114)
12:11:02    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)

Anything else?

mvn clean install -P enable-jacoco works fine

timja commented 2 years ago

It can be reliably reproduced on that commit, but pushing a new commit fixed it, I'm guessing some sort of hash collision

coyoteecd commented 2 years ago

I have ran into this as well when pushing a commit containing a very large amount of changes (a merge to a release branch), also reproducing reliably.

coyoteecd commented 2 years ago

In our case, I have tried pushing additional commits, renaming one of the offending "duplicate" files and/or making changes to the file itself. Neither worked.

Only workaround was deleting the previous builds that contained coverage information provided by the plugin. Note that we have used STORE_LAST_BUILD when publishing coverage reports. Not sure if this helps reproducing the error.

fo-code commented 2 years ago

Hi @coyoteecd ,

thanks a lot for the description and reporting! We might now have a guess what causes this problem - see #475 . I will implement a small fix in the Git Forensics Plugin today. Could you then update the Git Forensics Plugin and the Code Coverage API Plugin afterwards and check if this fixes the bug, please? This would be really helpful! I will write another message here when I have finished that.