X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-deploy.sh;h=4f6f58460240789b7e10e722e99c6a4b0baf6e64;hb=f3d8d908f8619e56869968469f860341538e2828;hp=fc8e2465c224f6921fc3c5ffbf83fd3a86bfd5a4;hpb=ed320523c5e3c70a6f54cf9f57369f8305f9b342;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-deploy.sh b/shell/maven-deploy.sh index fc8e2465..4f6f5846 100644 --- a/shell/maven-deploy.sh +++ b/shell/maven-deploy.sh @@ -13,6 +13,7 @@ # Requires the existance of $WORKSPACE/m2repo and $WORKSPACE/m2repo-backup to # compare if maven metadata files have changed. Unchanged files are then # removed from $WORKSPACE/m2repo before uploading to the snapshot repo. +echo "---> maven-deploy.sh" # Ensure we fail the job if any steps fail. set -eu -o pipefail @@ -20,20 +21,26 @@ set -eu -o pipefail m2repo_dir="$WORKSPACE/m2repo" nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO" -# Remove metadata files that were not updated. +lftools_activate + +echo "-----> Remove metadata files that were not updated" set +e # Temporarily disable to run diff command. -metadata_files=($(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \ - | grep 'Files .* and .* are identical' | awk '{print $2}')) +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 set -u # Re-enable. find "$m2repo_dir" -type d -empty -delete +maven_metadata_validate "$m2repo_dir" +echo "-----> Upload files to Nexus" lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"