Files
Andrei Gherzan fc46cbc4fb ci: prune unused sstate weekly
Nothing removes artifacts from the runner's SSTATE_DIR, so it grows without
bound. Delete sstate files not touched in 30 days. bitbake touches sstate files
whenever a build checks or unpacks them, so mtime tracks last use across all
branches.

DL_DIR is not pruned. Download stamps are only touched by do_fetch, which
sstate-restored recipes skip, so their age doesn't reflect whether a rebuild
would need them.

Signed-off-by: Andrei Gherzan <andrei@gherzan.com>
2026-10-19 04:47:48 +01:00

35 lines
882 B
YAML

# SPDX-FileCopyrightText: Andrei Gherzan <andrei@gherzan.com>
#
# SPDX-License-Identifier: MIT
---
name: Prune caches
on:
schedule:
- cron: "0 3 * * 0"
workflow_dispatch:
concurrency:
group: prune-caches
jobs:
sstate:
name: Prune unused sstate
runs-on: [self-hosted, Linux]
env:
DL_DIR: /var/lib/ci/yocto/downloads
SSTATE_DIR: /var/lib/ci/yocto/sstate
SSTATE_MAX_AGE_DAYS: 30
steps:
- name: Prune sstate not used in ${{ env.SSTATE_MAX_AGE_DAYS }} days
# bitbake touches sstate files whenever a build uses them, so mtime is
# a reliable last-use time.
run: |
du -sh "$DL_DIR" "$SSTATE_DIR"
find "$SSTATE_DIR" -type f -name 'sstate:*' \
-mtime +"$SSTATE_MAX_AGE_DAYS" -delete
find "$SSTATE_DIR" -mindepth 1 -type d -empty -delete
du -sh "$SSTATE_DIR"