Skip to content

Commit

Permalink
Remove unused docker cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emil-dealstack committed Jun 27, 2023
1 parent 700fbb7 commit 3019a53
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,3 @@ rm -rf "${HOME:?}"/* "${GITHUB_WORKSPACE:?}"/*
if test "${RUNNER_DEBUG:-0}" != '1'; then
set +o xtrace
fi

all_containers=()
readarray all_containers <<< "$(docker ps --all --quiet)"

protected_containers=()
if test "$INPUT_SERVICE_IDS" != '[]'; then
service_ids=$(jq -r '.[]' <<< "$INPUT_SERVICE_IDS")
readarray protected_containers <<< "$service_ids"
fi
self=$(cat /etc/hostname)
protected_containers+=("$self")

if test "${#protected_containers[@]}" -eq "${#all_containers[@]}"; then
echo 'No "extra" containers detected.' >&2
exit 0
fi

grep_flags=()
for id in "${protected_containers[@]}"; do
grep_flags+=('-e')
grep_flags+=("$(head -c 12 <<< "$id")")
done
printf '%s\n' "${all_containers[@]}" | grep -Fv "${grep_flags[@]}" | xargs docker rm --force

0 comments on commit 3019a53

Please sign in to comment.