3 # Copyright (c) 2020 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 echo "---> jjb/scripts/packagecloud_push.sh"
20 echo "STARTING PACKAGECLOUD PUSH"
24 FACTER_OS=$(/usr/bin/facter operatingsystem)
27 # PCIO_CO and SILO are Jenkins Global Environment variables defined in
28 # .../ci-management/jenkins-config/global-vars-*.sh
29 if [ -f ~/.packagecloud ]; then
32 FACTER_LSBNAME=$(/usr/bin/facter lsbdistcodename)
33 DEBS=$(find . -type f -iname '*.deb')
34 push_cmd="package_cloud push ${PCIO_CO}/${STREAM}/debian/${FACTER_LSBNAME}/main/ ${DEBS}"
37 FACTER_LSBNAME=$(/usr/bin/facter lsbdistcodename)
38 DEBS=$(find . -type f -iname '*.deb')
39 push_cmd="package_cloud push ${PCIO_CO}/${STREAM}/ubuntu/${FACTER_LSBNAME}/main/ ${DEBS}"
42 FACTER_OSMAJREL=$(/usr/bin/facter operatingsystemmajrelease)
43 FACTER_ARCH=$(/usr/bin/facter architecture)
44 RPMS=$(find . -type f -iregex '.*/.*\.\(s\)?rpm')
45 push_cmd="package_cloud push ${PCIO_CO}/${STREAM}/el/${FACTER_OSMAJREL}/os/${FACTER_ARCH}/ ${RPMS}"
48 echo "ERROR: Unsupported OS '$FACTER_OS'"
49 echo "PACKAGECLOUD PUSH FAILED!"
53 if [ "${SILO,,}" = "sandbox" ] ; then
54 echo "SANDBOX: skipping '$push_cmd'"
59 echo "ERROR: Missing '~/.packagecloud' for user '$(id)'"
60 echo "PACKAGECLOUD PUSH FAILED!"
64 echo "PACKAGECLOUD PUSH COMPLETE"