-
Notifications
You must be signed in to change notification settings - Fork 108
ci: build-yocto: cleanup sstate-cache after the build #820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ci: build-yocto: cleanup sstate-cache after the build #820
Conversation
fd6fa7d
to
8c8c6cf
Compare
97e0576
to
575eb01
Compare
.github/workflows/build-yocto.yml
Outdated
export SSTATE_DIR=${CACHE_DIR}/sstate-cache | ||
export KAS_WORK_DIR=$PWD/../kas | ||
SSTATE_CACHE_MANAGEMENT="${KAS_WORK_DIR}/poky/scripts/sstate-cache-management.py --cache-dir ${SSTATE_DIR} --remove-duplicated --remove-orphans --debug --yes" | ||
kas shell ci/${{ matrix.machine }}.yml --command "$SSTATE_CACHE_MANAGEMENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how long this script will take. My past recollection makes me think this will be pretty slow. Have you considered doing this on a cron schedule instead so that it doesn't affect day-to-day stuff as much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yocto docs about sstate-cache-management says
It has the ability to purge all but the newest cache files on each architecture, and also to remove files that it considers unreachable by exploring a set of build configurations. However, this command requires a full build environment to be available and doesn’t work well covering multiple releases.
Which is not very encouraging to be honest..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this first run it takes about 15 minutes for each machine but note that we have a very big sstate folder since it has never been cleaned yet. I expect to get much less time after this first interaction
7120836
to
fb17b7e
Compare
4af2fe8
to
2b1b5e2
Compare
We should run it on push event only, not PR. First it would run less often, and then we really care about sstate for metadata which is merged, not what's in a PR which is temporary. |
Test jobs for commit 2b1b5e2 |
f4d5567
to
18ba973
Compare
Good point! I have changed it to just run on git push events. |
Test jobs for commit 47b7c1d |
Test jobs for commit 18ba973 |
When I looked at clean-sstate-cache a few years ago, it would remove everything unrelated to your existing build, so it would delete sstate for all other machines. Does it still do this or has it become smarter? |
I believe the script is smart enough to support builds with more than one machine but I'm sure it will be like that. I will need to test this locally on my machine to actually see what it deletes. |
I'd go for a scheduled cleanup, e.g. once a week or so. |
that would indeed work better. even once a month.. but that also means we need to duplicate the build config/machines in that cleanup job, since we need to inherit the same matrix config, right? |
Can't we define machines in a common config file which gets included by both workflows? |
18ba973
to
c16b640
Compare
We need to clean up the ci local sstate-cache that is not used, otherwise it will grow infinitely. This will take up significant space that will not be used by anyone since invalid sstate-cache artefacts will no longer be needed. Since jobs on all machines in the matrix run simultaneously, we need some kind of lock to ensure that only one runs at a time. We use the flock tool for that propose. Signed-off-by: Jose Quaresma <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
c16b640
to
22e6473
Compare
We need to clean up the ci local sstate-cache that is not used, otherwise it will grow infinitely.
This will take up significant space that will not be used by anyone since invalid sstate-cache
artefacts will no longer be needed.
Fixes #715