From 86f57f37d2af3532edac220ebb0d9bd10d131a8a Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 31 Jan 2018 17:00:23 -0500 Subject: [PATCH] deploy cleanup not removing all unmodified files 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 --- shell/maven-deploy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/maven-deploy.sh b/shell/maven-deploy.sh index 6d4165ed..ac0f7293 100644 --- a/shell/maven-deploy.sh +++ b/shell/maven-deploy.sh @@ -24,7 +24,7 @@ lftools_activate # 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. @@ -32,6 +32,7 @@ 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 -- 2.16.6