The linting patch If87fceb79e384e26f021a9c85a2e9d7413ce421e
broke the cleanup script so unmodified maven-metadata.xml files
were not properly being cleaned up before upload to Nexus. This
caused the maven-merge job to update maven-metadata.xml files
outside of what was actually modified. So when 2 maven-merge jobs
running on different streams are run at the same time they would
overwrite each other with old data.
Issue: RELENG-766
Change-Id: I18da721bfb5db6eef9c15ffabd4482e0aa24e3a6
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
# Remove metadata files that were not updated.
set +e # Temporarily disable to run diff command.
-IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
+mapfile -t metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
| grep 'Files .* and .* are identical' \
| awk '{print $2}')"
set -e # Re-enable.
set +u # $metadata_files could be unbound if project is new.
if [ -n "${metadata_files[*]}" ]; then
for i in "${metadata_files[@]}"; do
+ echo "Removing unmodified file $i"
rm "$i"*
done
fi