Merge "Switch the csit-verify-1node to use job prefix"
[releng/builder.git] / jjb / packaging / build-rpm.sh
index 70f5e57a7d8aa961a84fc255584eba50bc0bfff6..9218d5a5fba25473e9554206c554ddfe5524354f 100644 (file)
@@ -30,12 +30,22 @@ if [[ $DOWNLOAD_URL = *.zip ]]; then
 fi
 
 # Build release specified by build params
-"$WORKSPACE/packaging/packages/build.py" --rpm --download_url "$DOWNLOAD_URL" \
+"$WORKSPACE/packaging/packages/build.py" --rpm \
                                          --changelog_name "$CHANGELOG_NAME" \
-                                         --changelog_email "$CHANGELOG_EMAIL"
+                                         --changelog_email "$CHANGELOG_EMAIL" \
+                                         direct \
+                                         --download_url "$DOWNLOAD_URL"
 
-# Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
-UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
-mkdir -p "$UPLOAD_FILES_PATH"
-mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
-mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+# Publish RPMs to Nexus if in production Jenkins, else host on sandbox Jenkins
+if [ "$SILO" == "sandbox" ]; then
+  echo "Not uploading RPMs to Nexus because running in sandbox"
+elif  [ "$SILO" == "releng" ]; then
+  # Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
+  UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+  mkdir -p "$UPLOAD_FILES_PATH"
+  cp "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
+  cp "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi