From 0acd1ca3066cc1a56199cd25174ae6972a75411b Mon Sep 17 00:00:00 2001 From: amin m Date: Wed, 7 Aug 2019 15:16:16 +0200 Subject: [PATCH] Upload changed RPMs/SRPMs to Nexus Change-Id: Id71de6e22b51b843a2f05f4113f0657496cb7c06 Signed-off-by: amin m --- jjb/shell/ta-rpm-deploy.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/jjb/shell/ta-rpm-deploy.sh b/jjb/shell/ta-rpm-deploy.sh index 36c7c5b..eeb1af6 100644 --- a/jjb/shell/ta-rpm-deploy.sh +++ b/jjb/shell/ta-rpm-deploy.sh @@ -23,12 +23,38 @@ repo_dir="$WORKSPACE/work/nexus/$NEXUS_REPO" x86_dir="$repo_dir/$release_path/rpms/x86_64" sources_dir="$repo_dir/$release_path/rpms/Sources" nexus_repo_url="$ALT_NEXUS_URL/repository/$NEXUS_REPO" +results_dir="$WORKSPACE/work/results" +repo_name=`echo $WORKSPACE | awk -F '/' '{print $4}' | cut -d '-' -f2- | sed 's|\(.*\)-.*|\1|'` + +#Creating dir to move duplicate RPMs/SRPMs to avoid re-upload +mkdir "$results_dir/repo/duplicates" +mkdir "$results_dir/src_repo/duplicates" + +#List all RPMs available in Nexus and move the duplicates +for artifact in \ + `ls $results_dir/repo` + do + if curl --head --fail $nexus_repo_url/$release_path/rpms/x86_64/$artifact + then + mv $results_dir/repo/$artifact $results_dir/repo/duplicates/ + fi + done + +#List all SRPMs available in Nexus and move the duplicates +for artifact in \ + `ls $results_dir/src_repo` + do + if curl --head --fail $nexus_repo_url/$release_path/rpms/Sources/$artifact + then + mv $results_dir/src_repo/$artifact $results_dir/src_repo/duplicates/ + fi + done mkdir -p "$x86_dir" mkdir -p "$sources_dir" -cp "$WORKSPACE/work/results/repo/"*.rpm "$x86_dir" -cp "$WORKSPACE/work/results/src_repo/"*.rpm "$sources_dir" +cp "$results_dir/repo/"*.rpm "$x86_dir" +cp "$results_dir/src_repo/"*.rpm "$sources_dir" echo "-----> Upload RPMs to Nexus" lftools deploy nexus "$nexus_repo_url" "$repo_dir" -- 2.16.6