File: gcpolicy.go

package info (click to toggle)
docker.io 20.10.25%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 60,880 kB
  • sloc: sh: 5,621; makefile: 593; ansic: 179; python: 162; asm: 7
file content (31 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package config

const defaultCap int64 = 2e9 // 2GB

func DefaultGCPolicy(p string, keep int64) []GCPolicy {
	if keep == 0 {
		keep = DetectDefaultGCCap(p)
	}
	return []GCPolicy{
		// if build cache uses more than 512MB delete the most easily reproducible data after it has not been used for 2 days
		{
			Filters:      []string{"type==source.local,type==exec.cachemount,type==source.git.checkout"},
			KeepDuration: 48 * 3600, // 48h
			KeepBytes:    512 * 1e6, // 512MB
		},
		// remove any data not used for 60 days
		{
			KeepDuration: 60 * 24 * 3600, // 60d
			KeepBytes:    keep,
		},
		// keep the unshared build cache under cap
		{
			KeepBytes: keep,
		},
		// if previous policies were insufficient start deleting internal data to keep build cache under cap
		{
			All:       true,
			KeepBytes: keep,
		},
	}
}