diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-09-02 00:55:04 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-09-03 21:40:06 -0400 |
commit | c7265f2b085025d85474acc99da6aa954dde393c (patch) | |
tree | 8975bfc7c84e64b8bb51550de86270f1408f7825 | |
parent | de6364afbdda1e0b3fb0258126cc9af62925937f (diff) |
ci: Ratelimit cleaning of stale jobs
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | ci/_test-git-branch.sh | 4 | ||||
-rwxr-xr-x | ci/get-test-job.sh | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/ci/_test-git-branch.sh b/ci/_test-git-branch.sh index 3924d23..2f5803f 100644 --- a/ci/_test-git-branch.sh +++ b/ci/_test-git-branch.sh @@ -22,7 +22,7 @@ sync_git_repos() local repo for repo in ${JOBSERVER_GIT_REPOS[@]}; do - (cd ~/$repo; git_fetch $repo || true; git checkout -f FETCH_HEAD) > /dev/null + (cd ~/$repo; git_fetch $repo && git checkout -f FETCH_HEAD) || true > /dev/null done } @@ -51,7 +51,7 @@ if [[ -z $TEST_PATH ]]; then exit 1 fi -echo "Running test $TEST_PATH for branch $BRANCH and commit $COMMIT" +echo "Running test $TEST_NAME for branch $BRANCH and commit $COMMIT" sync_git_repos git_fetch linux $COMMIT diff --git a/ci/get-test-job.sh b/ci/get-test-job.sh index bffba78..8b0e2a9 100755 --- a/ci/get-test-job.sh +++ b/ci/get-test-job.sh @@ -3,8 +3,17 @@ [[ -f ~/.ktestrc ]] && . ~/.ktestrc # Clean stale test jobs: + cd $JOBSERVER_OUTPUT_DIR -find -size 0 -cmin +180 |xargs rm -f > /dev/null + +if [[ ! -f stale-job-cleanup ]]; then + touch stale-job-cleanup +fi + +if [[ $(find stale-job-cleanup -mmin +5) ]]; then + find -size 0 -cmin +180 |xargs rm -f > /dev/null + touch stale-job-cleanup +fi cd $JOBSERVER_HOME/linux flock --nonblock .git_fetch.lock git fetch --all > /dev/null |