Clean up working directories after pipeline runs
See original GitHub issueIssue Type
- Feature enhancement
Summary
When a build is finished, we should clean up the working directory to save disk space.
Basic environment details
- Go Version: 19.11.0
Expected Results
When a build is finished and artifacts have been uploaded, the working directory of the pipeline should be cleaned up (git clean -xdf
).
Actual Results
The working directory is not being cleaned up. When running many different builds on one agent, we run out of disk space quickly.
Possible Fix
Add an option to the pipeline configuration that runs git clean -xdf
or similar after a pipeline has run. We already do this before each pipeline run to ensure a clean slate.
We can’t easily add a generic cleanup step as a pipeline tasks because it breaks uploading artifacts (such as test reports) to the GoCD server (they will be cleaned up before they can be uploaded).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Azure DevOps - Clean build directory - Stack Overflow
The problem is when I run any build and it failed due to some issues in the pipeline. The cloned branch from remote...
Read more >Post Build Cleanup - Visual Studio Marketplace
The Post Build Cleanup task deletes unwanted files from your build agent, after your build has run, thus, saving precious disk space.
Read more >Shell executor doesn't clean up build directories - GitLab
Am I correct in thinking that this would only work with a single runner running only one job concurrently? Let's say you have...
Read more >Any way to clean up pipelines directory on agent machine?
What I really need is something to clean the working directory after the job has completed to reduce the impact on the disk...
Read more >Azure DevOps Clean after pipeline run
What is the preferred way of cleaning the agents' work directories? The problem is, that the clean process is in the beginning of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 to this issue. We are manually cleaning up the working directory in several of our pipelines to save disk space. (We also have >500 pipelines, and it isn’t sufficient to just use “clean working directory”.)
Issue still exists as described.