Introduction
When Jenkins runs jobs, it stores files in a workspace folder. Over time, these files can pile up and cause storage issues or conflicts. Workspace cleanup removes old files to keep the environment clean and ready for new builds.
When you want to remove leftover files from previous builds to avoid conflicts.
When disk space on the Jenkins server is running low due to accumulated workspace files.
Before starting a new build to ensure a fresh environment without old artifacts.
After a build finishes to keep the workspace tidy and prevent clutter.
When troubleshooting build failures caused by stale or corrupted files in the workspace.