Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up working directories after pipeline runs #7386

Open
dziemba opened this issue Dec 5, 2019 · 17 comments
Open

Clean up working directories after pipeline runs #7386

dziemba opened this issue Dec 5, 2019 · 17 comments

Comments

@dziemba
Copy link

dziemba commented Dec 5, 2019

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

@adityasood
Copy link
Contributor

adityasood commented Dec 11, 2019

@dziemba have you tried the Clean Working Directory option in the stage settings?

Screen Shot 2019-12-11 at 12 15 38 PM

Screen Shot 2019-12-11 at 12 18 14 PM

@dziemba
Copy link
Author

dziemba commented Dec 11, 2019

Yes I am aware of this option and we're already using it.

The issue is that we have a lot (>500) pipelines that run on a relatively small amount of agents. This means that even though the working dir gets cleaned up before the job runs, having the build artifacts stay on disk for this large amount of pipelines wastes a lot of disk space quicky. Thus it would be great if we can also clean up after the jobs have run.

@drewinglis
Copy link

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

@stale
Copy link

stale bot commented Apr 22, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Apr 22, 2020
@dziemba
Copy link
Author

dziemba commented Apr 23, 2020

Issue still exists as described.

@stale stale bot removed the stale label Apr 23, 2020
@stale
Copy link

stale bot commented Jul 22, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Jul 22, 2020
@dziemba
Copy link
Author

dziemba commented Jul 22, 2020

Issue still exists as described.

@stale stale bot removed the stale label Jul 22, 2020
@stale
Copy link

stale bot commented Oct 20, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Oct 20, 2020
@dziemba
Copy link
Author

dziemba commented Oct 20, 2020

Issue still exists as described.

@stale stale bot removed the stale label Oct 20, 2020
@stale
Copy link

stale bot commented Jan 18, 2021

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Jan 18, 2021
@drewinglis
Copy link

Issue still exists as described.

@stale stale bot removed the stale label Jan 20, 2021
@stale
Copy link

stale bot commented Apr 21, 2021

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Apr 21, 2021
@sriramnrn
Copy link

sriramnrn commented Apr 21, 2021 via email

@stale stale bot removed the stale label Apr 21, 2021
@dziemba
Copy link
Author

dziemba commented Apr 21, 2021

@sriramnrn Yes, that's exactly it :)

@stale
Copy link

stale bot commented Jul 20, 2021

This issue has been automatically marked as stale because it has not had activity in the last 90 days.
If you can still reproduce this error on the master branch using local development environment or on the latest GoCD Release, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@stale stale bot added the stale label Jul 20, 2021
@arvindsv
Copy link
Member

Telling the stale bot to not handle this issue / mark it stale.

@stale stale bot removed the stale label Jul 20, 2021
@arvindsv arvindsv added the no stalebot Don't mark this stale. label Jul 20, 2021
@asavchkov
Copy link

In my view what the GoCD pipeline model is missing is "post" type actions. I am already so badly in need of a post-job action (running after all job activities including uploading artifacts have finished) and a post-stage action (running after all jobs have completed). Such post actions may be further configured to run on success, on failure or always.
That way, one could just run their own custom cleaning task in a post-job action when all artifacts have already been uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants