dotnet / docker-tools

This is a repo to house some common tools for our various docker repos.
MIT License
122 stars 46 forks source link

Consider removing the image cleanup logic in pipelines #1213

Closed mthalman closed 5 months ago

mthalman commented 6 months ago

The common pipeline implementation contains logic to cleanup Docker state before and after images are built:

These steps can add a fair amount of execution time, especially on Windows agents. Some recent runs have shown this taking 5 minutes on a Windows agent.

At the time this was implemented, build agents were potentially reused between runs and it was important to keep the state of the agents clean. Since then, however, we're using stateless pools that provide fresh agents each time. So there really isn't much need to clean the agent. The one exception might be for cases where we would run out of disk space. That's most likely to happen in the .NET Framework pipeline.

So, by default, I propose that we eliminate the clean steps. If it's necessary to clean for disk space purposes, this is something that can be opted into.

dotnet-issue-labeler[bot] commented 6 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

lbussell commented 6 months ago

[Triage] There is more investigation to be done here. We should take special care to make sure we don't include any of the Microsoft hosted runners' cached images (windows, linux) in our build output. At the very least we could remove the cleanup step from the end of the build.

lbussell commented 5 months ago

Removed the majority of the cleanup steps with https://github.com/dotnet/docker-tools/pull/1229.