From a783e75dc37e607d5661a10f87535c8e9c4d5afb Mon Sep 17 00:00:00 2001 From: zcain117 Date: Mon, 24 Aug 2020 02:04:20 -0700 Subject: [PATCH] Fix tpu cleanup (#3056) * Only try to delete jobs if there are any to delete. * Reorder jobs. * Remove cleanup from the jobs that run on every commit. --- .circleci/config.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eb44da7d8d..0fd5dd3e22 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,8 +90,11 @@ references: # Match jobs whose age matches patterns like '1h' or '1d', i.e. any job # that has been around longer than 1hr. First print all columns for # matches, then execute the delete. - kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}' - kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}') + jobs_to_delete=$(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}') + echo $jobs_to_delete + if [ ${#jobs_to_delete} -gt 1 ]; + then kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}'); + fi jobs: