Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47748

Second archiveArtifacts step fails silently with compress-artifacts-plugin

    Details

    • Similar Issues:

      Description

      I put two archiveArtifacts steps in a declarative Jenkinsfile but only the files archived by the first step show up in the Jenkins UI.

      dir('bin/Release') {
          archiveArtifacts artifacts: 'data/*.xml', fingerprint: true, onlyIfSuccessful: true
          archiveArtifacts artifacts: '**/*', excludes: '**/*.xml', fingerprint: true, onlyIfSuccessful: true
      }
      

      The build directory in the Jenkins master then contains both "archive.zip" with files from the first step, and "archive.zip.writing.zip" with files from the second step. I think the tempArchive.renameTo(archive); call in ZipStorage failed. There is a comment "TODO support updating entries", so this is apparently a known problem.

      However, if this kind of thing is not supported, then I think the build should at least have failed with an explanation in Console Output. I got no warnings there, and the build succeeded:

      [Pipeline] dir
      Running in CENSORED\bin\Release
      [Pipeline] {
      [Pipeline] archiveArtifacts
      Archiving artifacts
      Recording fingerprints
      [Pipeline] archiveArtifacts
      Archiving artifacts
      Recording fingerprints
      [Pipeline] }
      [Pipeline] // dir
      [Pipeline] }
      

        Attachments

          Activity

          Hide
          olivergondza Oliver Gondža added a comment -

          Correct, with truezip this should be possible to implement.

          Show
          olivergondza Oliver Gondža added a comment - Correct, with truezip this should be possible to implement.
          Hide
          kon Kalle Niemitalo added a comment -

          The error-handling flaw seems distinct from JENKINS-45200, in which the job ultimately failed. Here, the job succeeded but some of the artifacts were missing.

          Show
          kon Kalle Niemitalo added a comment - The error-handling flaw seems distinct from JENKINS-45200 , in which the job ultimately failed. Here, the job succeeded but some of the artifacts were missing.
          Hide
          kon Kalle Niemitalo added a comment -

          The tempArchive.renameTo(archive) call goes to File.renameTo(File), which returns false if it fails, and compress-artifacts-plugin ignores this return value. So, that's why the run succeeded despite the error.

          I didn't find any other places where the plugin ignores return values from File.

          Show
          kon Kalle Niemitalo added a comment - The tempArchive.renameTo(archive) call goes to File.renameTo(File) , which returns false if it fails, and compress-artifacts-plugin ignores this return value. So, that's why the run succeeded despite the error. I didn't find any other places where the plugin ignores return values from File.
          Hide
          luvarqpp Lubo Varga added a comment -

          I am using scripted pipeline, where there are multiple parallel build steps (owasp dependency check, mvn test, code coverage) and they could run on different nodes/dockers, so I need to call archiveArtifacts multiple times.

          Is there any methodical workaround for situations like these?

          Show
          luvarqpp Lubo Varga added a comment - I am using scripted pipeline, where there are multiple parallel build steps (owasp dependency check, mvn test, code coverage) and they could run on different nodes/dockers, so I need to call archiveArtifacts multiple times. Is there any methodical workaround for situations like these?
          Hide
          olivergondza Oliver Gondža added a comment -

          This is just not implemented in compress-artifacts plugin. It should not be that difficult as underlying truezip library appears to support that.

          Help wanted!

          Show
          olivergondza Oliver Gondža added a comment - This is just not implemented in compress-artifacts plugin. It should not be that difficult as underlying truezip library appears to support that. Help wanted!
          Hide
          kon Kalle Niemitalo added a comment -

          Lubo Varga, a workaround might be to stash the files from each node and unstash all of them to the same node, then archive them from there using only one archiveArtifacts step.

          Show
          kon Kalle Niemitalo added a comment - Lubo Varga , a workaround might be to stash the files from each node and unstash all of them to the same node, then archive them from there using only one archiveArtifacts step.

            People

            • Assignee:
              olivergondza Oliver Gondža
              Reporter:
              kon Kalle Niemitalo
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: