Skip to content

Commit

Permalink
Remove empty log files and use a slightly different process kill method
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Feb 1, 2015
1 parent 4f739e4 commit 40a4115
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions hack/test-end-to-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,27 @@ function cleanup()
osc get -n test builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n test >"${LOG_DIR}/stibuild.log"
osc get -n docker builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n docker >"${LOG_DIR}/dockerbuild.log"
osc get -n custom builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n custom >"${LOG_DIR}/custombuild.log"

curl -L http://localhost:4001/v2/keys/?recursive=true > "${ARTIFACT_DIR}/etcd_dump.json"
set -e

echo ""
echo

set +u
if [ "$SKIP_TEARDOWN" != "1" ]; then
set +e
if [[ -z "${SKIP_TEARDOWN-}" ]]; then
echo "[INFO] Tearing down test"
sudo pkill -P $$
echo "[INFO] Stopping docker containers"; docker ps -aq | xargs -l -r docker stop
pgid="$(ps opgid= "$$")"
sudo kill -- "-${pgid}"
set +u
if [ "$SKIP_IMAGE_CLEANUP" != "1" ]; then
echo "[INFO] Removing docker containers"; docker ps -aq | xargs -l -r docker rm
echo "[INFO] Stopping k8s docker containers"; docker ps | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}' | xargs -l -r docker stop
if [[ -z "${SKIP_IMAGE_CLEANUP-}" ]]; then
echo "[INFO] Removing k8s docker containers"; docker ps -a | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}' | xargs -l -r docker rm
fi
set -u
set -e
fi
set -u

set -e

# clean up zero byte log files
# Clean up large log files so they don't end up on jenkins
find ${ARTIFACT_DIR} -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
find ${LOG_DIR} -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
find ${ARTIFACT_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
find ${LOG_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
find ${LOG_DIR} -name *.log -size 0 -exec echo Deleting {} because it is empty. \; -exec rm -f {} \;

echo "[INFO] Exiting"
exit $out
Expand Down

0 comments on commit 40a4115

Please sign in to comment.