btrfs-progs: ci: update cleanup scripts

Add limit parameter so workflows are not skipped if they don't fit the
default limit 10. Add more workflows to clean up after recent updates.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-08-16 21:34:28 +02:00
parent a00c2b2547
commit 7c3b897803
8 changed files with 17 additions and 12 deletions

View File

@ -8,7 +8,7 @@ repo="kdave/btrfs-progs"
type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; } type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; } type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
for id in $(gh run -R "$repo" list --workflow "$workflow" --status failure --json databaseId | jq '.[].databaseId'); do for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --status failure --json databaseId | jq '.[].databaseId'); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -16,11 +16,13 @@ notthatone() {
exit 1 exit 1
} }
areyousure() {
echo "WARNING: protected branch, make sure you want to remove it: $1"
}
case "$branch" in case "$branch" in
master) notthatone "$branch";; master) notthatone "$branch";;
devel) notthatone "$branch";; devel) areyousure "$branch";;
coverage-test) notthatone "$branch";;
release-test) notthatone "$branch";;
esac esac
echo "Delete all runs of branch $branch, are you sure? [y/N]" echo "Delete all runs of branch $branch, are you sure? [y/N]"
@ -31,7 +33,7 @@ if ! [ "$answer" = 'y' ]; then
fi fi
echo echo
for id in $(gh run -R "$repo" list --json databaseId --branch "$branch" | jq '.[].databaseId'); do for id in $(gh run -R "$repo" list --limit 100 --json databaseId --branch "$branch" | jq '.[].databaseId'); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; } type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
for branch in master release-test; do for branch in master release-test; do
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; } type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
for branch in master coverage-test; do for branch in master coverage-test; do
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -7,7 +7,7 @@ repo="kdave/btrfs-progs"
from=11 from=11
for id in $(gh run -R "$repo" list -w 'Devel build and tests' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do for id in $(gh run -R "$repo" list --limit 100 --workflow 'Devel build and tests' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; } type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
for branch in master release-test; do for branch in master release-test; do
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
echo "Delete run $id" echo "Delete run $id"
gh run -R "$repo" delete "$id" gh run -R "$repo" delete "$id"
done done

View File

@ -11,7 +11,7 @@ daysmax=8
clean_workflow() { clean_workflow() {
local wf="$1" local wf="$1"
local json=$(gh run -R "$repo" list --workflow "$wf" --json databaseId,startedAt) local json=$(gh run -R "$repo" list --limit 100 --workflow "$wf" --json databaseId,startedAt)
echo "Cleaning workflow $wf" echo "Cleaning workflow $wf"
i=0 i=0
@ -40,3 +40,6 @@ clean_workflow() {
clean_workflow "Testing CI build" clean_workflow "Testing CI build"
clean_workflow "Devel build and tests" clean_workflow "Devel build and tests"
clean_workflow "Pull request build and tests" clean_workflow "Pull request build and tests"
clean_workflow "Codespell"
clean_workflow "CI image tests"
clean_workflow "Sanitizer checks"

View File

@ -16,8 +16,8 @@ repo="kdave/btrfs-progs"
tag="$1" tag="$1"
# TODO: verify that tag exists # TODO: verify that tag exists
# Read last workflow id # Read last workflow id for master branch
id=$(gh run -R "$repo" list -w 'Static binaries' -L 1 --json databaseId | jq '.[].databaseId') id=$(gh run -R "$repo" list --limit 1 --workflow 'Static binaries' --branch 'master' --json databaseId | jq '.[].databaseId')
for asset in btrfs.box.static btrfs.static; do for asset in btrfs.box.static btrfs.static; do
gh run -R "$repo" download "$id" -n "$asset" gh run -R "$repo" download "$id" -n "$asset"