Skip to content

Commit

Permalink
#210 Fix report history for projects containing word latest
Browse files Browse the repository at this point in the history
  • Loading branch information
fescobar committed Mar 12, 2024
1 parent 60f6471 commit 2e62272
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion allure-docker-scripts/cleanAllureHistory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ "$(ls -A $PROJECT_LATEST_REPORT | wc -l)" != "0" ]; then
fi

if [ "$(ls -A $PROJECT_REPORTS_DIRECTORY | wc -l)" != "0" ]; then
ls -d $PROJECT_REPORTS_DIRECTORY/* | grep -v /latest | grep -wv 0 | xargs rm 2 -rf> /dev/null
ls -d $PROJECT_REPORTS_DIRECTORY/* | grep -wv $PROJECT_REPORTS_DIRECTORY/latest | grep -wv 0 | xargs rm 2 -rf> /dev/null
fi

if [ -e $PROJECT_RESULTS_HISTORY ]; then
Expand Down
3 changes: 2 additions & 1 deletion allure-docker-scripts/generateAllureReport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ EXECUTION_TYPE=$6
PROJECT_REPORTS=$STATIC_CONTENT_PROJECTS/$PROJECT_ID/reports
if [ "$(ls $PROJECT_REPORTS | wc -l)" != "0" ]; then
if [ -e "$PROJECT_REPORTS/latest" ]; then
LAST_REPORT_PATH_DIRECTORY=$(ls -td $PROJECT_REPORTS/* | grep -v /latest | grep -v $EMAILABLE_REPORT_FILE_NAME | head -1)
echo "LATEST EJECUTA"
LAST_REPORT_PATH_DIRECTORY=$(ls -td $PROJECT_REPORTS/* | grep -wv $PROJECT_REPORTS/latest | grep -v $EMAILABLE_REPORT_FILE_NAME | head -1)
else
LAST_REPORT_PATH_DIRECTORY=$(ls -td $PROJECT_REPORTS/* | grep -v $EMAILABLE_REPORT_FILE_NAME | head -1)
fi
Expand Down
4 changes: 2 additions & 2 deletions allure-docker-scripts/keepAllureLatestHistory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ if [ "$KEEP_HISTORY" == "TRUE" ] || [ "$KEEP_HISTORY" == "true" ] || [ "$KEEP_HI
if echo $KEEP_HISTORY_LATEST | egrep -q '^[0-9]+$'; then
KEEP_LATEST=$KEEP_HISTORY_LATEST
fi
CURRENT_SIZE=$(ls -Ad $PROJECT_REPORTS_DIRECTORY/* | grep -v /latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | wc -l)
CURRENT_SIZE=$(ls -Ad $PROJECT_REPORTS_DIRECTORY/* | grep -wv $PROJECT_REPORTS_DIRECTORY/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 -v /latest | grep -wv 0 | grep -v $EMAILABLE_REPORT_FILE_NAME | tail -$SIZE_TO_REMOVE | xargs rm 2 -rf> /dev/null
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
fi
fi

0 comments on commit 2e62272

Please sign in to comment.