Merge "add csit stream for p4plugin"
[releng/builder.git] / jjb / packaging / build-rpm-snap.sh
index ebecea802b8a61d68591de7e4f0112b7dc9dae7c..5d2b55c21a4bc74753a66fe06a9475776ed117b8 100644 (file)
@@ -14,14 +14,8 @@ PYTHON="rpm_build/bin/python"
 $PYTHON -m pip install --upgrade pip
 $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
 
-# Extract stream from job name (format: foo-job-name-<stream>)
-# shellcheck disable=SC1083
-STREAM=${{JOB_NAME##*-}}
-
 # Convert stream to numeric ODL major version
-if [ "$STREAM" == "boron" ]; then
-  VERSION_MAJOR=5
-elif [ "$STREAM" == "carbon" ]; then
+if [ "$STREAM" == "carbon" ]; then
   VERSION_MAJOR=6
 elif [ "$STREAM" == "nitrogen" ]; then
   VERSION_MAJOR=7
@@ -39,8 +33,17 @@ fi
                                          latest_snap \
                                          --major "$VERSION_MAJOR"
 
-# Copy the rpm to be upload
-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
+  # TODO: Host RPMs on Jenkins temporarily
+  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"
+  mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
+  mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi