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

Archive artifacts shouldn't archive artifacts when build fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • Jenkins 1.432

      When a build fails in the cleaning workspace step, Jenkins will still
      archive the artifacts. Since the workspace couldn't be cleaned, that
      means the archived artifacts are from a previous build, and are invalid.
      If a build fails because the workspace couldn't be cleaned, it should
      never archive any artifacts, as they are guaranteed to be from a previous
      build.

      Note that this is different from when a build fails in one of the build
      steps. In that case, artifacts may or may not be valid, but they are
      at least from that build. There should be an option to not archive
      artifacts when a build fails in this case.

      If the difference between the two isn't clear, consider a CI job that
      runs a test harness, and archives the test results as an artifact. When
      some tests fail, the job fails, but the artifact is still valid. When
      the job fails before any of the build steps are run, the test results
      from the previous run are archived. That leads to confusion, where
      people (and automated systems) see "build failed", and then look at
      the artifact, to see which tests are broken, never realizing that the
      tests never ran at all.

      Here's a sample build log:

      Started by upstream project "MAPI_Validate_6_3" build number 98
      Building remotely on ml-xp-vm01
      Cleaning workspace C:\jenkins\workspace\MAPI_Validate_6_3\HOST\x86-windows-xp\PLATFORM\vc6
      hudson.util.IOException2: remote file operation failed: c:\jenkins\workspace\MAPI_Validate_6_3\HOST/x86-windows-xp/PLATFORM/vc6 at hudson.remoting.Channel@56e7a30e:ml-xp-vm01
      	at hudson.FilePath.act(FilePath.java:781)
      	at hudson.FilePath.act(FilePath.java:767)
      	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:731)
      	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:676)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1193)
      	at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:566)
      	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:454)
      	at hudson.model.Run.run(Run.java:1389)
      	at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:230)
      Caused by: java.io.IOException: Unable to delete c:\jenkins\workspace\MAPI_Validate_6_3\HOST\x86-windows-xp\PLATFORM\vc6\src\omneon\pcapps\mediareader\validate\ommedia-binaries\hostemu.exe
      	at hudson.Util.deleteFile(Util.java:266)
      	at hudson.Util.deleteRecursive(Util.java:316)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.Util.deleteRecursive(Util.java:307)
      	at hudson.Util.deleteContentsRecursive(Util.java:227)
      	at hudson.scm.subversion.CheckoutUpdater$1.perform(CheckoutUpdater.java:74)
      	at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:136)
      	at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:773)
      	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:754)
      	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:738)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2022)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:287)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at hudson.remoting.Engine$1$1.run(Engine.java:60)
      	at java.lang.Thread.run(Unknown Source)
      Retrying after 10 seconds
      [...]
      Archiving artifacts
      Notifying upstream projects of job completion
      Finished: FAILURE
      

            Unassigned Unassigned
            ammon Ammon Riley
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: