#!/usr/bin/env bash set -euo pipefail echo "report dir: ${1}" dir="${1:-"tmp/junit"}" echo "collecting junit reports to $dir" echo "cleaning $dir" rm -rf "$dir" echo "creating $dir" mkdir -p "$dir" files=() while IFS='' read -r line; do files+=("$line"); done < <(find -L "$(bazel info bazel-testlogs)" -name 'test.xml') for FILE in "${files[@]}" do new="$dir/$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c10).xml" echo "copying $FILE to $new" cp "$FILE" "$new" done echo "done"