diff --git a/.gitlab/collect_reports.sh b/.gitlab/collect_reports.sh index 6b16d7da472..a2f811c3cf9 100755 --- a/.gitlab/collect_reports.sh +++ b/.gitlab/collect_reports.sh @@ -43,35 +43,35 @@ cp /tmp/*.dmp $REPORTS_DIR 2>/dev/null || true cp /tmp/dd-profiler/*.jfr $REPORTS_DIR 2>/dev/null || true function process_reports () { - project_to_save=$1 + project_dir=$1 + project_to_save=${project_dir#workspace/} report_path=$REPORTS_DIR/$project_to_save if [ "$DELETE" = true ]; then echo "deleting reports for $project_to_save" - rm -rf workspace/$project_to_save/build/reports/* || true - rm -rf workspace/$project_to_save/build/hs_err_pid*.log || true - rm -rf workspace/$project_to_save/build/javacore*.txt || true + rm -rf $project_dir/build/reports/* || true + rm -rf $project_dir/build/hs_err_pid*.log || true + rm -rf $project_dir/build/javacore*.txt || true elif [ "$MOVE" = true ]; then echo "moving reports for $project_to_save" mkdir -p $report_path - mv -f workspace/$project_to_save/build/reports/* $report_path/ || true - mv -f workspace/$project_to_save/build/hs_err_pid*.log $report_path/ || true - mv -f workspace/$project_to_save/build/javacore*.txt $report_path/ || true + mv -f $project_dir/build/reports/* $report_path/ || true + mv -f $project_dir/build/hs_err_pid*.log $report_path/ || true + mv -f $project_dir/build/javacore*.txt $report_path/ || true else echo "copying reports for $project_to_save" mkdir -p $report_path - cp -r workspace/$project_to_save/build/reports/* $report_path/ 2>/dev/null || true - cp workspace/$project_to_save/build/hs_err_pid*.log $report_path/ 2>/dev/null || true - cp workspace/$project_to_save/build/javacore*.txt $report_path/ 2>/dev/null || true - cp workspace/$project_to_save/build/dumps/*.* $report_path/ 2>/dev/null || true + cp -r $project_dir/build/reports/* $report_path/ 2>/dev/null || true + cp $project_dir/build/hs_err_pid*.log $report_path/ 2>/dev/null || true + cp $project_dir/build/javacore*.txt $report_path/ 2>/dev/null || true + cp $project_dir/build/dumps/*.* $report_path/ 2>/dev/null || true fi } -shopt -s globstar +# Match the roots used by the JUnit result collector. +shopt -s nullglob -for report_path in workspace/**/build/reports; do - report_path=${report_path//workspace\//} - report_path=${report_path//\/build\/reports/} - process_reports $report_path +for report_path in workspace/**/build/reports buildSrc/**/build/reports build-logic/**/build/reports; do + process_reports "${report_path%/build/reports}" done tar -czf reports.tar $REPORTS_DIR