Skip to content
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

cache clean workflow #598

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c28dc1a
Add cache clean w/f outline
alan-forbes-cp Nov 21, 2024
932a4e7
add pull request
alan-forbes-cp Nov 21, 2024
866db0e
first gh cache command
alan-forbes-cp Nov 21, 2024
3f26260
add action install
alan-forbes-cp Nov 21, 2024
7a2bd82
Add GH token
alan-forbes-cp Nov 21, 2024
0445626
add subcommand help output
alan-forbes-cp Nov 21, 2024
26a26fe
add grep to find latest caches
alan-forbes-cp Nov 21, 2024
323bab1
restore checkout
alan-forbes-cp Nov 21, 2024
adf476f
update logic to identify cache for deletion
alan-forbes-cp Nov 22, 2024
ce02898
Add echo for cache deletions
alan-forbes-cp Nov 22, 2024
b1f0b78
Fix delete list
alan-forbes-cp Nov 22, 2024
19f0722
Tidy delete list
alan-forbes-cp Nov 22, 2024
8539f05
Fix ordering
alan-forbes-cp Nov 22, 2024
84680ee
add before / after logging
alan-forbes-cp Nov 22, 2024
fcc3c2e
add dryrun
alan-forbes-cp Nov 22, 2024
65e19ce
add push
alan-forbes-cp Nov 22, 2024
a6494c9
remove push
alan-forbes-cp Nov 22, 2024
efe62eb
add input to pr run
alan-forbes-cp Nov 22, 2024
f4a1727
add execution on dryrun
alan-forbes-cp Nov 22, 2024
45f8ab2
fix dry run logging
alan-forbes-cp Nov 22, 2024
3accd0d
swap dryrun logic
alan-forbes-cp Nov 22, 2024
964af78
update logging and schedule
alan-forbes-cp Nov 22, 2024
bb68bf0
set perms explicitly
alan-forbes-cp Nov 22, 2024
99e8166
set job actions perms
alan-forbes-cp Nov 22, 2024
89782ad
add test deletion using perms
alan-forbes-cp Nov 22, 2024
b440c28
set perms to write
alan-forbes-cp Nov 22, 2024
99ca971
Update TODOS and add args VARS for gh commnds
alan-forbes-cp Nov 22, 2024
b6d02fa
align commants
alan-forbes-cp Nov 22, 2024
5ab5417
define cache prefix list
alan-forbes-cp Nov 22, 2024
3e46044
update comments remove checkout
alan-forbes-cp Nov 22, 2024
a488cec
add sparse checkout
alan-forbes-cp Nov 22, 2024
4db6fd3
change asc to desc - fix order
alan-forbes-cp Nov 22, 2024
2dc230a
set prefix list for main repo
alan-forbes-cp Nov 22, 2024
b9369b0
Tidy comments and formatting
alan-forbes-cp Nov 25, 2024
90f1f72
Review updates and explicitly disable caching for CodeQL
alan-forbes-cp Nov 26, 2024
d85dce6
Fix cron setting
alan-forbes-cp Nov 26, 2024
6063c58
Remove echo from deletion for "live"
alan-forbes-cp Nov 27, 2024
ca8d366
Add conditional for repo and schedule event
alan-forbes-cp Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
align commants
alan-forbes-cp committed Nov 22, 2024
commit b6d02fa59807419039e6e34eb21243ef5a49a570
8 changes: 4 additions & 4 deletions .github/workflows/cache_clean.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
name: Cache clean

on:
# TODO: restore schedule
# TODO restore schedule
#schedule:
# # Run Mon-Sun at 11pm
# - cron: '00 23 * * 1-7'
@@ -13,7 +13,7 @@ on:
required: true
type: boolean
default: true
# TODO: delete pull_request
# TODO delete pull_request
pull_request:

concurrency:
@@ -43,13 +43,13 @@ jobs:
echo BEFORE ...
gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST
# Define unique cache prefixes in list for deletion
# TODO: set prefixes correctly
# TODO set prefixes correctly
PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-"
# Generate corresponding list of cache keys for deletion - retain only the newest entry for each prefix
DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done)
echo DELETIONS ...
# Delete caches via keys in DELETE_LIST if not dryrun
# TODO: remove non-dryrun echo for live use
# TODO remove non-dryrun echo for live use
for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete $GH_DELETE_ARGS $KEY ; done
# Generate post-clean list
echo AFTER ...