We have been using Habitat for almost a year now and our build/deployment machine is running low on space. I have already been able to find the results and cache artifacts, but I noticed that in the /hab/cache there are now many 2018 build hart files and many 2019 ones. Is it safe to delete the older versions?
Yes, you can safely remove those cached artifacts.
Things get added to
/hab/cache whenever you install something... if you were to ever need them again, the
hab CLI tool could take the local artifact on disk, rather than going out to Builder to get it. For running services and their dependencies, Habitat uses the unpacked artifacts in
/hab/pkgs/$ORIGIN/$PACKAGE/$VERSION/$RELEASE, so removing the cached
*.hart files won't impact running services.
One potential caveat is that if the packages weren't on Builder (or an on-premises depot) in the first place (i.e., you're doing some home-grown thing with your package creation and storage), and you ever did need those artifacts again, for whatever reason, you'd want to make sure you've got copies of the ones you care about stashed away somewhere safe before you delete them. But in the general case, you're fine to remove them and save a bit of space.
Hope that helps!