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

Cleanup not working on build failure


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ws-cleanup-plugin
    • None
    • centos7
      ws-cleanup 0.34
      jenkins 2.129

      Workspace is not being deleted on a failed build.
      If cleanWs() is at the end and build fails on steps before, cleanWs is not run.

      To reproduce:

          sh 'ls -la'
          touch file: 'bla.txt'
          sh 'lsa -la'

      Also tried with cleanWs cleanWhenFailure: true but it also does not work.

      Additionally, IMO, cleanWs() should be able to be called on any step of the pipeline and only triggered at the end of the build, accordingly to the build status setup in the pipeline.

      When setup at the beginning, it seems to clean the workspace immediately.

      Did not see any errors on logger, with log level ALL.

            olivergondza Oliver Gond┼ża
            ncosta Nuno Costa
            0 Vote for this issue
            2 Start watching this issue