Closed Bug 699219 Opened 13 years ago Closed 12 years ago

Add automated clean up of hg-shared directory

Categories

(Release Engineering :: General, defect, P5)

x86
All
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nthomas, Assigned: catlee)

Details

(Whiteboard: [buildslaves])

Attachments

(2 files, 1 obsolete file)

We currently accumulate repositories when shared repositories is enabled, and need some way to bound the disk usage. We could remove repositories in which the tip is older than some age, or limit the space the whole of hg-shared is allowed to use and expire the oldest repo's first. 

purge_builds.py may be a good place to do this, but would have to be taught how to look up hg revisions, and the way directories are mapped out in hg-share (eg mozilla-central, releases/mozilla-beta, rather than flat in a master dir).
This isn't quite as smart as your suggestion, but easier to write.

It looks for directories under $HG_SHARE_BASE_DIR with a .hg subdirectory, and then calls the regular purge() logic on that set.

This means that max_age will be enforced for these directories as well.

HG_SHARE_BASE_DIR must be set in the environment for this to work (requires a buildbotcustom change)
Attachment #588855 - Flags: feedback?(nrthomas)
Assignee: nobody → catlee
Comment on attachment 588855 [details] [diff] [review]
use purge_builds.py to delete hg shared dirs

>+    # Clean up empty directories
>+    for d in hg_dirs:
>+        if not os.path.exists(os.path.join(d, '.hg')):
>+            print "Deleting", d

Maybe say |'Cleaning up', d| since there will already be a log line with "Deleting d" from purge().

So how might this go in practice ? We delete a lot of shared clones before we zap *any* builds, and so might do a lot more cloning ? Having a longer max-age may be useful for hg-shared.
Attachment #588855 - Flags: feedback?(nrthomas) → feedback+
Attachment #588855 - Attachment is obsolete: true
Attachment #589255 - Flags: review?(nrthomas)
Comment on attachment 589255 [details] [diff] [review]
use purge_builds.py to delete hg shared dirs

Lets give it a go.
Attachment #589255 - Flags: review?(nrthomas) → review+
Attachment #589255 - Flags: checked-in+
Attachment #589954 - Flags: review?(nrthomas)
Attachment #589954 - Flags: review?(nrthomas) → review+
Attachment #589954 - Flags: checked-in+
Merged to production today.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Product: mozilla.org → Release Engineering
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: