jenkinsci / allure-plugin

Allure Jenkins Plugin
https://plugins.jenkins.io/allure-jenkins-plugin/
Other
84 stars 62 forks source link

2.31.x breaks "Restart from Stage" with FileAlreadyExistsException #343

Open PayBas opened 8 months ago

PayBas commented 8 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.414.3 OS: Linux - 6.5.10-200.fc38.x86_64 Java: 11.0.20 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- active-directory:2.34 allure-jenkins-plugin:2.30.3 ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 audit-trail:357.v916a_82927d6e authentication-tokens:1.53.v1c90fd9191a_b_ blueocean:1.27.9 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.9 blueocean-commons:1.27.9 blueocean-config:1.27.9 blueocean-core-js:1.27.9 blueocean-dashboard:1.27.9 blueocean-display-url:2.4.2 blueocean-events:1.27.9 blueocean-git-pipeline:1.27.9 blueocean-github-pipeline:1.27.9 blueocean-i18n:1.27.9 blueocean-jira:1.27.9 blueocean-jwt:1.27.9 blueocean-personalization:1.27.9 blueocean-pipeline-api-impl:1.27.9 blueocean-pipeline-editor:1.27.9 blueocean-pipeline-scm-api:1.27.9 blueocean-rest:1.27.9 blueocean-rest-impl:1.27.9 blueocean-web:1.27.9 bootstrap5-api:5.3.2-2 bouncycastle-api:2.29 branch-api:2.1128.v717130d4f816 build-failure-analyzer:2.4.2 build-monitor-plugin:1.14-745.ve2023a_305f40 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-bitbucket-branch-source:848.v42c6a_317eda_e cloudbees-disk-usage-simple:187.v6378d330d1d4 cloudbees-folder:6.858.v898218f3609d command-launcher:107.v773860566e2e commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-94.v3e1f4a_926e49 credentials:1309.v8835d63eb_d8a_ credentials-binding:642.v737c34dea_6c2 custom-folder-icon:2.10 dark-theme:336.v02165cd8c2ee data-tables-api:1.13.6-5 dependency-check-jenkins-plugin:5.4.3 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 durable-task:523.va_a_22cf15d5e0 echarts-api:5.4.0-7 email-ext:2.102 extended-read-permission:53.v6499940139e5 favorite:2.4.3 font-awesome-api:6.4.2-1 git:5.2.0 git-client:4.5.0 git-server:99.va_0826a_b_cdfa_d github:1.37.3.1 github-api:1.316-451.v15738eef3414 github-branch-source:1741.va_3028eb_9fd21 groovy:457.v99900cb_85593 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.32 http_request:1.18 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.3-372.v309620682326 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jdk-tool:73.vddf737284550 jenkins-design-language:1.27.9 jersey2-api:2.41-133.va_03323b_a_1396 jira:3.11 jjwt-api:0.11.5-77.v646c772fddb_0 jobConfigHistory:1229.v3039470161a_d jquery3-api:3.7.1-1 jsch:0.2.8-65.v052c39de79b_2 junit:1240.vf9529b_881428 kubernetes:4054.v2da_8e2794884 kubernetes-client-api:6.8.1-224.vd388fca_4db_3b_ kubernetes-credentials:0.11 lockable-resources:1185.v0c528656ce04 logstash:2.5.0218.v0a_ff8fefc12b_ mailer:463.vedf8358e006b_ matrix-auth:3.2.1 matrix-project:818.v7eb_e657db_924 metrics:4.2.18-442.v02e107157925 mina-sshd-api-common:2.11.0-86.v836f585d47fa_ mina-sshd-api-core:2.11.0-86.v836f585d47fa_ nexus-jenkins-plugin:3.18.0-03 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 openshift-client:1.1.0.420.v8817277c1990 pipeline-build-step:516.v8ee60a_81c5b_9 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:689.veec561a_dee13 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2150.v4cfd8916915c pipeline-model-definition:2.2150.v4cfd8916915c pipeline-model-extensions:2.2150.v4cfd8916915c pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2150.v4cfd8916915c pipeline-stage-view:2.34 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.6.0 prometheus:2.3.3 prometheus-lockable-resources:1.0.0 pubsub-light:1.18 resource-disposer:0.23 scm-api:676.v886669a_199a_a_ script-security:1275.v23895f409fb_d simple-theme-plugin:160.vb_76454b_67900 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.16.1 sse-gateway:1.26 ssh-agent:346.vda_a_c4f2c8e50 ssh-credentials:308.ve4497b_ccd8f4 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 testcafe:1.0 theme-manager:211.vef2a_42c645a_b_ timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 variant:60.v7290fc0eb_b_cd workflow-aggregator:596.v8c21c963d92d workflow-api:1283.v99c10937efcb_ workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3806.va_3a_6988277b_2 workflow-durable-task-step:1289.v4d3e7b_01546b_ workflow-job:1360.vc6700e3136f5 workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 ```

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

Fedora Server 38

Reproduction steps

  1. Run a multi-stage pipeline build containing the allure() step in one of the stages (or 'post').
  2. Let it finish and make sure the following file is created on the Jenkins master: jobs/<job-name>/branches/<branch-name>/builds/1/archive/allure-report.zip
  3. Run a second build using the "Restart from Stage" pipeline function.
  4. Observe that jobs/<job-name>/branches/<branch-name>/builds/2/archive/allure-report.zip is immediately copied over from the first build (not sure if this is intended behavior).
  5. Let the build finish. It will error.

Expected Results

allure-report.zip is overridden by the allure() step in the second build.

Actual Results

00:43:13.577  Report successfully generated to /home/jenkins-agent/workspace/myjob_develop/allure-report
00:43:13.632  Allure report was successfully generated.
00:43:13.632  Creating artifact for the build.
...
00:43:14.717  Error when executing always post condition:
00:43:14.722  Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 44c87903-1d50-418a-9347-820d4645a66d
00:43:14.722  java.nio.file.FileAlreadyExistsException: /opt/jenkins/jobs/myjob/branches/develop/builds/1000/archive/allure-report.zip
00:43:14.722    at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:450)
00:43:14.722    at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:267)
00:43:14.722    at java.base/java.nio.file.Files.move(Files.java:1422)
00:43:14.722    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.saveAllureArtifact(AllureReportPublisher.java:387)
00:43:14.722    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:362)
00:43:14.722    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:269)
00:43:14.722    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
00:43:14.722    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
00:43:14.722    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
00:43:14.722    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
00:43:14.722    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
00:43:14.722    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
00:43:14.722    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
00:43:14.722    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
00:43:14.722    at java.base/java.lang.Thread.run(Thread.java:829) 

Anything else?

Reverting to 2.30.3 fixed the issue.

AMEntwistle commented 8 months ago

We have also encountered this issue exactly as described above

DanielLiu-326 commented 7 months ago

346 may helpful

yuriy-poret commented 5 months ago

I also reproduced this bug.

maris-salenieks commented 4 months ago

We are also looking forward for this fix.