Merge "Modify logs publisher"
[ci-management.git] / jjb / scripts / packagecloud_push.sh
index 8eba7f7..95ea92e 100644 (file)
@@ -1,14 +1,19 @@
 #!/bin/bash
 # PCIO_CO is a Jenkins Global Environment variable
 
-set -xe -o pipefail
+set -x
 
 echo "STARTING PACKAGECLOUD PUSH"
 
 sleep 10
 
-FACTER_OS=$(/usr/bin/facter operatingsystem)
-if [ -f /root/.packagecloud ]; then
+if [ -f /usr/bin/zypper ]; then
+    FACTER_OS="openSUSE"
+else
+    FACTER_OS=$(/usr/bin/facter operatingsystem)
+fi
+
+if [ -f ~/.packagecloud ]; then
     case "$FACTER_OS" in
       Ubuntu)
         FACTER_LSBNAME=$(/usr/bin/facter lsbdistcodename)
@@ -21,5 +26,14 @@ if [ -f /root/.packagecloud ]; then
         RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm')
         package_cloud push "${PCIO_CO}/${STREAM}/el/${FACTER_OSMAJREL}/os/${FACTER_ARCH}/" ${RPMS}
       ;;
+      openSUSE)
+        # Use /etc/os-release on openSUSE to get $VERSION
+        . /etc/os-release
+        RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm' | grep -v 'vpp-ext-deps')
+        VPP_EXT_RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm' | grep 'vpp-ext-deps')
+        package_cloud push "${PCIO_CO}/${STREAM}/opensuse/${VERSION}/" ${RPMS}
+        # This file may have already been uploaded. Don't error out if it exists.
+        package_cloud push "${PCIO_CO}/${STREAM}/opensuse/${VERSION}/" ${VPP_EXT_RPMS} --skip-errors
+      ;;
     esac
 fi