From: Thanh Ha Date: Wed, 31 Jan 2018 22:00:23 +0000 (-0500) Subject: deploy cleanup not removing all unmodified files X-Git-Tag: v0.16.0~15 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F8623%2F1;p=releng%2Fglobal-jjb.git 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 --- 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