Open Temikus opened 4 years ago
This looks cool. It's a benchmark of sorts. these types of tasks I've put in bench.yaml
workflows and they do not block CI. I like running these checks and not blocking on them as a way to measure stats over time.
See https://github.com/artichoke/boba/blob/55124bf7d3e82ef274ceb6dbffe9e6a8a53adbc2/.github/workflows/bench.yaml for an example.
How does one fix a failed check here?
dive
scans for inefficiencies by looking at whether the files get overwritten in multiple layers, wasting overall space.
It does give you a list of files to look at, e.g.:
λ dive --ci haugene/transmission-openvpn
Using config file: /Users/temikus/.dive.yaml
Using default CI config
Image Source: docker://haugene/transmission-openvpn
Fetching image... (this can take a while for large images)
Analyzing image...
efficiency: 96.9607 %
wastedBytes: 18154395 bytes (18 MB)
userWastedPercent: 6.7145 %
Inefficient Files:
Count Wasted Space File Path
2 3.2 MB /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
2 1.3 MB /var/cache/debconf/templates.dat
2 834 kB /lib/x86_64-linux-gnu/libfdisk.so.1.1.0
2 742 kB /var/lib/dpkg/info/libstdc++6:amd64.symbols
2 680 kB /lib/x86_64-linux-gnu/libmount.so.1.1.0
2 623 kB /lib/x86_64-linux-gnu/libblkid.so.1.1.0
2 562 kB /var/cache/apt/pkgcache.bin
2 484 kB /var/log/dpkg.log
2 425 kB /var/cache/apt/srcpkgcache.bin
2 392 kB /lib/x86_64-linux-gnu/libsmartcols.so.1.1.0
2 336 kB /var/lib/dpkg/status
2 296 kB /var/log/lastlog
2 250 kB /sbin/fdisk
2 217 kB /sbin/sfdisk
2 193 kB /sbin/cfdisk
2 193 kB /lib/x86_64-linux-gnu/libgcc_s.so.1
2 185 kB /sbin/zramctl
2 184 kB /sbin/fsck.minix
2 176 kB /sbin/blkid
2 176 kB /usr/bin/partx
2 168 kB /sbin/losetup
2 168 kB /bin/lsblk
2 160 kB /sbin/mkfs.minix
2 160 kB /sbin/mkswap
2 144 kB /bin/dmesg
2 144 kB /usr/bin/lsipc
2 144 kB /usr/bin/lscpu
2 136 kB /usr/share/gcc-8/python/libstdcxx/v6/printers.py
2 130 kB /bin/findmnt
2 128 kB /usr/share/doc/gcc-8-base/copyright
2 127 kB /usr/bin/lslogins
...
2 0 B /usr/share/doc/mount/mount.txt
2 0 B /sbin/getty
2 0 B /usr/share/doc/util-linux/changelog.Debian.gz
2 0 B /usr/share/doc/fdisk/changelog.Debian.gz
Results:
PASS: highestUserWastedPercent
SKIP: highestWastedBytes: rule disabled
PASS: lowestEfficiency
Result:PASS [Total:3] [Passed:2] [Failed:0] [Warn:0] [Skipped:1]
We can run it both as a benchmark and a gate (e.g. prevent us from wasting 50% image space or something high like that).
Sounds great let's do it.
I believe it's worth it to make image efficiency scanning (e.g.
dive
) a step in CI to make sure we don't bloat the images later down the road.WDYT?