Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix shellcheck errors in scripts
[releng/global-jjb.git]
/
shell
/
maven-deploy.sh
diff --git
a/shell/maven-deploy.sh
b/shell/maven-deploy.sh
index
6d4165e
..
f9e2889
100644
(file)
--- a/
shell/maven-deploy.sh
+++ b/
shell/maven-deploy.sh
@@
-1,4
+1,4
@@
-#!/bin/bash
+#!/bin/bash
-l
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
@@
-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.
# 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
# Ensure we fail the job if any steps fail.
set -eu -o pipefail
@@
-20,11
+21,9
@@
set -eu -o pipefail
m2repo_dir="$WORKSPACE/m2repo"
nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
m2repo_dir="$WORKSPACE/m2repo"
nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
-lftools_activate
-
-# Remove metadata files that were not updated.
+echo "-----> Remove metadata files that were not updated"
set +e # Temporarily disable to run diff command.
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.
| grep 'Files .* and .* are identical' \
| awk '{print $2}')"
set -e # Re-enable.
@@
-32,6
+31,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
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
rm "$i"*
done
fi
@@
-39,4
+39,10
@@
set -u # Re-enable.
find "$m2repo_dir" -type d -empty -delete
find "$m2repo_dir" -type d -empty -delete
+echo "-----> Install lftools"
+# shellcheck disable=SC1090
+source ~/lf-env.sh
+lf-activate-venv lftools
+
+echo "-----> Upload files to Nexus"
lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"
lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"