question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clean up working directories after pipeline runs

See original GitHub issue
Issue 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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
drewingliscommented, Jan 23, 2020

+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”.)

2reactions
drewingliscommented, Jan 20, 2021

Issue still exists as described.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found