Search code examples
jenkins-2

Clean workspace in Jenkins2


I have an issue in Jenkins2 that a build is failing and only clean to workspace fix the problem. In Jenkins1 I was able to clean the workspace manually, in Jenkins2 I don't see this issue.

I'm deleting the remote branches and recraete them to clean the workspace but I can't do that for master.

How can I clean the workspace without delete the remote branch?


Solution

  • I've found that the problem was a broken symlink in node_modules directory so I've used to following task to clean it:

    task cleanBrokenSymlinksInNodeModules << {
        file("node_modules").eachFileRecurse {
            if (! it.exists()) { it.delete() }
        }
    }
    

    I've copy this solution from GRADLE-1843