Skip to content

Commit 84c044d

Browse files
committed
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 <[email protected]>
1 parent 269d106 commit 84c044d

8 files changed

+17
-12
lines changed

ci/actions/delete-all-failed-devel-runs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repo="kdave/btrfs-progs"
88
type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
99
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
1010

11-
for id in $(gh run -R "$repo" list --workflow "$workflow" --status failure --json databaseId | jq '.[].databaseId'); do
11+
for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --status failure --json databaseId | jq '.[].databaseId'); do
1212
echo "Delete run $id"
1313
gh run -R "$repo" delete "$id"
1414
done

ci/actions/delete-all-runs-of-branch

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ notthatone() {
1616
exit 1
1717
}
1818

19+
areyousure() {
20+
echo "WARNING: protected branch, make sure you want to remove it: $1"
21+
}
22+
1923
case "$branch" in
2024
master) notthatone "$branch";;
21-
devel) notthatone "$branch";;
22-
coverage-test) notthatone "$branch";;
23-
release-test) notthatone "$branch";;
25+
devel) areyousure "$branch";;
2426
esac
2527

2628
echo "Delete all runs of branch $branch, are you sure? [y/N]"
@@ -31,7 +33,7 @@ if ! [ "$answer" = 'y' ]; then
3133
fi
3234
echo
3335

34-
for id in $(gh run -R "$repo" list --json databaseId --branch "$branch" | jq '.[].databaseId'); do
36+
for id in $(gh run -R "$repo" list --limit 100 --json databaseId --branch "$branch" | jq '.[].databaseId'); do
3537
echo "Delete run $id"
3638
gh run -R "$repo" delete "$id"
3739
done

ci/actions/keep-last-ci-image-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
99
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
1010

1111
for branch in master release-test; do
12-
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
12+
for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
1313
echo "Delete run $id"
1414
gh run -R "$repo" delete "$id"
1515
done

ci/actions/keep-last-coverage

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
99
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
1010

1111
for branch in master coverage-test; do
12-
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
12+
for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
1313
echo "Delete run $id"
1414
gh run -R "$repo" delete "$id"
1515
done

ci/actions/keep-last-devel-runs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repo="kdave/btrfs-progs"
77

88
from=11
99

10-
for id in $(gh run -R "$repo" list -w 'Devel build and tests' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do
10+
for id in $(gh run -R "$repo" list --limit 100 --workflow 'Devel build and tests' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do
1111
echo "Delete run $id"
1212
gh run -R "$repo" delete "$id"
1313
done

ci/actions/keep-last-static-binaries

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type -p gh > /dev/null || { echo "ERROR: gh tool not found"; exit 1; }
99
type -p jq > /dev/null || { echo "ERROR: jq tool not found"; exit 1; }
1010

1111
for branch in master release-test; do
12-
for id in $(gh run -R "$repo" list --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
12+
for id in $(gh run -R "$repo" list --limit 100 --workflow "$workflow" --branch "$branch" --json databaseId | jq '.[1:] | .[].databaseId'); do
1313
echo "Delete run $id"
1414
gh run -R "$repo" delete "$id"
1515
done

ci/actions/keep-last-week

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ daysmax=8
1111

1212
clean_workflow() {
1313
local wf="$1"
14-
local json=$(gh run -R "$repo" list --workflow "$wf" --json databaseId,startedAt)
14+
local json=$(gh run -R "$repo" list --limit 100 --workflow "$wf" --json databaseId,startedAt)
1515

1616
echo "Cleaning workflow $wf"
1717
i=0
@@ -40,3 +40,6 @@ clean_workflow() {
4040
clean_workflow "Testing CI build"
4141
clean_workflow "Devel build and tests"
4242
clean_workflow "Pull request build and tests"
43+
clean_workflow "Codespell"
44+
clean_workflow "CI image tests"
45+
clean_workflow "Sanitizer checks"

ci/actions/update-artifacts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repo="kdave/btrfs-progs"
1616
tag="$1"
1717
# TODO: verify that tag exists
1818

19-
# Read last workflow id
20-
id=$(gh run -R "$repo" list -w 'Static binaries' -L 1 --json databaseId | jq '.[].databaseId')
19+
# Read last workflow id for master branch
20+
id=$(gh run -R "$repo" list --limit 1 --workflow 'Static binaries' --branch 'master' --json databaseId | jq '.[].databaseId')
2121

2222
for asset in btrfs.box.static btrfs.static; do
2323
gh run -R "$repo" download "$id" -n "$asset"

0 commit comments

Comments
 (0)