Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed cleaning of old reports when the project name contains "0" #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions allure-docker-scripts/keepAllureLatestHistory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
PROJECT_ID=$1

if [ "$KEEP_HISTORY" == "TRUE" ] || [ "$KEEP_HISTORY" == "true" ] || [ "$KEEP_HISTORY" == "1" ] ; then
PROJECT_REPORTS_DIRECTORY=$STATIC_CONTENT_PROJECTS/$PROJECT_ID/reports
cd "$STATIC_CONTENT_PROJECTS"/"$PROJECT_ID"/ || exit
KEEP_LATEST="20"
if echo $KEEP_HISTORY_LATEST | egrep -q '^[0-9]+$'; then
KEEP_LATEST=$KEEP_HISTORY_LATEST
fi
CURRENT_SIZE=$(ls -Ad $PROJECT_REPORTS_DIRECTORY/* | grep -wv $PROJECT_REPORTS_DIRECTORY/latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | wc -l)
CURRENT_SIZE=$(ls -Ad reports/* | grep -wv reports/latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | wc -l)

if [ "$CURRENT_SIZE" -gt "$KEEP_LATEST" ]; then
SIZE_TO_REMOVE="$(($CURRENT_SIZE-$KEEP_LATEST))"
echo "Keeping latest $KEEP_LATEST history reports for PROJECT_ID: $PROJECT_ID"
ls -tAd $PROJECT_REPORTS_DIRECTORY/* | grep -wv $PROJECT_REPORTS_DIRECTORY/latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | tail -$SIZE_TO_REMOVE | xargs rm 2 -rf> /dev/null
ls -tAd reports/* | grep -wv reports/latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | tail -$SIZE_TO_REMOVE | xargs rm 2 -rf> /dev/null
fi
fi