btrfs-progs: ci: update maintenance scripts

- use proper json array filtering
- use long parameter names
- add comments
- add cleaner for coverage runs
- keep last run for branches with badges at README

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-07-27 15:40:53 +02:00
parent 54c11ec03f
commit b28ce934b0
4 changed files with 29 additions and 19 deletions

View File

@ -1,11 +1,14 @@
#!/bin/sh -xe
#
# Delete all failed devel runs
workflow='Devel build and tests'
repo="kdave/btrfs-progs"
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; }
repo="kdave/btrfs-progs"
for id in $(gh run -R "$repo" list -w 'Devel build and tests' -s failure --json databaseId | jq '.[].databaseId'); do
for id in $(gh run -R "$repo" list --workflow "$workflow" --status failure --json databaseId | jq '.[].databaseId'); do
echo "Delete run $id"
gh run -R "$repo" delete "$id"
done

View File

@ -1,13 +1,16 @@
#!/bin/sh -xe
#
# Keep last runs of master and release-test
workflow='CI image tests'
repo="kdave/btrfs-progs"
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; }
repo="kdave/btrfs-progs"
from=3
for id in $(gh run -R "$repo" list -w 'CI image tests' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do
echo "Delete run $id"
gh run -R "$repo" delete "$id"
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
echo "Delete run $id"
gh run -R "$repo" delete "$id"
done
done

View File

@ -1,13 +1,16 @@
#!/bin/sh -xe
#
# Keep last runs of master and release-test
workflow='Static binaries'
repo="kdave/btrfs-progs"
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; }
repo="kdave/btrfs-progs"
from=3
for id in $(gh run -R "$repo" list -w 'Static binaries' --json databaseId | jq '.[].databaseId' | tail -n +${from}); do
echo "Delete run $id"
gh run -R "$repo" delete "$id"
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
echo "Delete run $id"
gh run -R "$repo" delete "$id"
done
done

View File

@ -1,4 +1,6 @@
#!/bin/sh -e
#
# Keep only last week worth of CI runs, selected workflows
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; }
@ -9,7 +11,7 @@ daysmax=8
clean_workflow() {
local wf="$1"
local json=$(gh run -R "$repo" list -w "$wf" --json databaseId,startedAt)
local json=$(gh run -R "$repo" list --workflow "$wf" --json databaseId,startedAt)
echo "Cleaning workflow $wf"
i=0
@ -37,4 +39,3 @@ clean_workflow() {
clean_workflow "Testing CI build"
clean_workflow "Devel build and tests"
clean_workflow "CI image tests"