packagecloud_push.sh revision be612c32
1#!/bin/bash
2# PCIO_CO is a Jenkins Global Environment variable
3
4set -x
5
6echo "STARTING PACKAGECLOUD PUSH"
7
8sleep 10
9
10if [ -f /usr/bin/zypper ]; then
11    FACTER_OS="openSUSE"
12else
13    FACTER_OS=$(/usr/bin/facter operatingsystem)
14fi
15
16if [ -f ~/.packagecloud ]; then
17    case "$FACTER_OS" in
18      Ubuntu)
19        FACTER_LSBNAME=$(/usr/bin/facter lsbdistcodename)
20        DEBS=$(find . -type f -iname '*.deb')
21        package_cloud push "${PCIO_CO}/${STREAM}/ubuntu/${FACTER_LSBNAME}/main/" ${DEBS}
22      ;;
23      CentOS)
24        FACTER_OSMAJREL=$(/usr/bin/facter operatingsystemmajrelease)
25        FACTER_ARCH=$(/usr/bin/facter architecture)
26        RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm')
27        package_cloud push "${PCIO_CO}/${STREAM}/el/${FACTER_OSMAJREL}/os/${FACTER_ARCH}/" ${RPMS}
28      ;;
29      openSUSE)
30        # Use /etc/os-release on openSUSE to get $VERSION
31        . /etc/os-release
32        RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm' | grep -v 'vpp-ext-deps')
33        VPP_EXT_RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm' | grep 'vpp-ext-deps')
34        package_cloud push "${PCIO_CO}/${STREAM}/opensuse/${VERSION}/" ${RPMS}
35        # This file may have already been uploaded. Don't error out if it exists.
36        package_cloud push "${PCIO_CO}/${STREAM}/opensuse/${VERSION}/" ${VPP_EXT_RPMS} --skip-errors
37      ;;
38    esac
39fi
40