Merge "Add INFO.yaml verify job"
[ci-management.git] / jjb / scripts / packagecloud_push.sh
1 #!/bin/bash
2 # PCIO_CO is a Jenkins Global Environment variable
3
4 set -x
5
6 echo "STARTING PACKAGECLOUD PUSH"
7
8 sleep 10
9
10 if [ -f /usr/bin/zypper ]; then
11     FACTER_OS="openSUSE"
12 else
13     FACTER_OS=$(/usr/bin/facter operatingsystem)
14 fi
15
16 if [ -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
39 fi