aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/scripts/download_hc_pkgs.sh
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-03-05 14:41:35 +0100
committerMichal Cmarada <mcmarada@cisco.com>2019-03-05 17:00:27 +0000
commit022a4e8f9169de9adcee6498507da50333a727d1 (patch)
tree6b474cd6e4c7b02af200f91877d9e00ce658aa5e /resources/tools/scripts/download_hc_pkgs.sh
parent71675350204b5e6a451537643f9e3e1d95cc3845 (diff)
CSIT-1362: migrate package download scripts for hc2vpp jobs
As part of Bionic update for honeycomb (HC2VPP-372) scripts need to be updated. Switching to Packagecloud instead of nexus simplifies this process. Change-Id: I243367e8c1d7c3de5890d6846c199563cef457bf Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'resources/tools/scripts/download_hc_pkgs.sh')
-rwxr-xr-xresources/tools/scripts/download_hc_pkgs.sh115
1 files changed, 68 insertions, 47 deletions
diff --git a/resources/tools/scripts/download_hc_pkgs.sh b/resources/tools/scripts/download_hc_pkgs.sh
index caa92c555e..fb629da404 100755
--- a/resources/tools/scripts/download_hc_pkgs.sh
+++ b/resources/tools/scripts/download_hc_pkgs.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2017 Cisco and/or its affiliates.
+# Copyright (c) 2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -18,34 +18,41 @@ set -x
STREAM=$1
OS=$2
-URL="https://nexus.fd.io/service/local/artifact/maven/content"
-VER="RELEASE"
-GROUP="io.fd.vpp"
-HC_GROUP="io.fd.hc2vpp"
-HC_ARTIFACTS="honeycomb"
# TODO(CSIT-994): reenable NSH
# NSH_GROUP="io.fd.nsh_sfc"
# NSH_ARTIFACTS="vpp-nsh-plugin"
-VPP_ARTIFACTS="vpp vpp-lib vpp-plugins"
-
-if [ "${OS}" == "ubuntu1604" ]; then
- OS="ubuntu.xenial.main"
- PACKAGE="deb deb.md5"
- CLASS="deb"
-elif [ "${OS}" == "centos7" ]; then
- OS="centos7"
- PACKAGE="rpm rpm.md5"
- CLASS=""
+# Figure out what system we are running on
+if [[ -f /etc/os-release ]];then
+ source /etc/os-release
+else
+ echo "Cannot determine OS version"
+ exit 1
fi
+echo "----- OS INFO -----"
+echo DISTRIB_ID: ${ID}
+echo DISTRIB_RELEASE: ${VERSION_ID}
+echo DISTRIB_CODENAME: ${VERSION_CODENAME}
+echo DISTRIB_DESCRIPTION: ${PRETTY_NAME}
-REPO="fd.io.${STREAM}.${OS}"
-
-# download latest honeycomb and nsh packages
-for ART in ${HC_ARTIFACTS}; do
- for PAC in ${PACKAGE}; do
- curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
- done
-done
+VERSION="RELEASE"
+echo "----- DOWNLOADING HONEYCOMB AND JVPP PACKAGES -----"
+REPO_URL="https://packagecloud.io/fdio/${STREAM}"
+echo "REPO_URL: ${REPO_URL}"
+if [[ "$ID" == "ubuntu" ]]; then
+ if [[ -f /etc/apt/sources.list.d/99fd.io.list ]];then
+ echo "Deleting: /etc/apt/sources.list.d/99fd.io.list"
+ sudo rm /etc/apt/sources.list.d/99fd.io.list
+ fi
+ curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.deb.sh | sudo bash
+ apt-get download honeycomb vpp-api-java || true
+elif [[ "$ID" == "centos" ]]; then
+ if [[ -f /etc/yum.repos.d/fdio-master.repo ]]; then
+ echo "Deleting: /etc/yum.repos.d/fdio-master.repo"
+ sudo rm /etc/yum.repos.d/fdio-master.repo
+ fi
+ curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.rpm.sh | sudo bash
+ sudo yum -y install --downloadonly --downloaddir=./ honeycomb vpp-api-java || true
+fi
# TODO(CSIT-994): reenable NSH
# for ART in ${NSH_ARTIFACTS}; do
@@ -56,37 +63,51 @@ done
# determine VPP dependency
# use latest if honeycomb package does not depend on single VPP version, e.g. stable branches since HC2VPP-285
-VER="RELEASE"
-if [ "${OS}" == "centos7" ]; then
+VERSION="RELEASE"
+if [[ "${OS}" == "centos7" ]]; then
HC_VPP_VER=`rpm -qpR honeycomb*.rpm | grep -oP 'vpp = \K.+'`
- if [ "${HC_VPP_VER}" != "" ]; then
- VER=${HC_VPP_VER}.x86_64
+ if [[ "${HC_VPP_VER}" != "" ]]; then
+ VERSION=${HC_VPP_VER}.x86_64
fi
else
HC_VPP_VER=`dpkg -I honeycomb*.deb | grep -oP 'vpp \(= \K[^\)]+'`
- if [ "${HC_VPP_VER}" != "" ]; then
- VER=${HC_VPP_VER}_amd64
+ if [[ "${HC_VPP_VER}" != "" ]]; then
+ VERSION=${HC_VPP_VER}
fi
fi
-# download VPP packages
+VPP_DEB_NEW_ARTIFACTS="vpp libvppinfra vpp-plugin-core"
+VPP_DEB_ARTIFACTS="vpp vpp-lib vpp-plugins"
+VPP_RPM_ARTIFACTS="vpp vpp-lib vpp-plugins"
+# Check OS and stream to set correct packages
+if [[ "$ID" == "centos" ]]; then
+ VPP_ARTIFACTS=${VPP_RPM_ARTIFACTS}
+elif [[ "$ID" == "ubuntu" ]]; then
+ if [[ "1807 1810 1901" =~ .*$STREAM.* ]]; then
+ VPP_ARTIFACTS=${VPP_DEB_ARTIFACTS}
+ else
+ VPP_ARTIFACTS=${VPP_DEB_NEW_ARTIFACTS}
+ fi
+fi
+VPP_DEB_PACKAGES=""
+VPP_RPM_PACKAGES=""
+INSTALL_PACKAGES=""
for ART in ${VPP_ARTIFACTS}; do
- for PAC in ${PACKAGE}; do
- curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
- done
+ INSTALL_PACKAGES="$INSTALL_PACKAGES $ART*"
+ if [[ "${VERSION}" != 'RELEASE' ]]; then
+ VPP_DEB_PACKAGES="$VPP_DEB_PACKAGES $ART=$VERSION"
+ VPP_RPM_PACKAGES="$VPP_RPM_PACKAGES $ART-$VERSION"
+ else
+ VPP_DEB_PACKAGES="$VPP_DEB_PACKAGES $ART"
+ VPP_RPM_PACKAGES="$VPP_RPM_PACKAGES $ART"
+ fi
done
-# verify downloaded package
-if [ "${OS}" == "centos7" ]; then
- FILES=*.rpm
-else
- FILES=*.deb
+echo "----- DOWNLOADING VPP PACKAGES -----"
+REPO_URL="https://packagecloud.io/fdio/${STREAM}"
+echo "REPO_URL: ${REPO_URL}"
+if [[ "$ID" == "ubuntu" ]]; then
+ apt-get download ${VPP_DEB_PACKAGES} || true
+elif [[ "$ID" == "centos" ]]; then
+ sudo yum -y install --downloadonly --downloaddir=./ ${VPP_RPM_PACKAGES} || true
fi
-
-for FILE in ${FILES}; do
- echo " "${FILE} >> ${FILE}.md5
-done
-for MD5FILE in *.md5; do
- md5sum -c ${MD5FILE} || exit
- rm ${MD5FILE}
-done \ No newline at end of file