HC Tests: do not use vpp-dbg in CSIT tests
[csit.git] / resources / tools / scripts / download_hc_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2017 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:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 set -x
17
18 STREAM=$1
19 OS=$2
20
21 URL="https://nexus.fd.io/service/local/artifact/maven/content"
22 VER="RELEASE"
23 GROUP="io.fd.vpp"
24 HC_GROUP="io.fd.hc2vpp"
25 NSH_GROUP="io.fd.nsh_sfc"
26 HC_ARTIFACTS="honeycomb"
27 NSH_ARTIFACTS="vpp-nsh-plugin"
28
29 if [ "${OS}" == "ubuntu1404" ]; then
30     OS="ubuntu.trusty.main"
31     PACKAGE="deb deb.md5"
32     CLASS="deb"
33     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins"
34 elif [ "${OS}" == "ubuntu1604" ]; then
35     OS="ubuntu.xenial.main"
36     PACKAGE="deb deb.md5"
37     CLASS="deb"
38     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins"
39 elif [ "${OS}" == "centos7" ]; then
40     OS="centos7"
41     PACKAGE="rpm rpm.md5"
42     CLASS=""
43     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins"
44 fi
45
46 REPO="fd.io.${STREAM}.${OS}"
47
48 # download latest honeycomb and nsh packages
49 for ART in ${HC_ARTIFACTS}; do
50     for PAC in ${PACKAGE}; do
51         curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
52     done
53 done
54
55 for ART in ${NSH_ARTIFACTS}; do
56     for PAC in ${PACKAGE}; do
57         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
58     done
59 done
60
61 # determine VPP dependency
62 # use latest if honeycomb package does not depend on single VPP version, e.g. stable branches since HC2VPP-285
63 VER="RELEASE"
64 if [ "${OS}" == "centos7" ]; then
65     HC_VPP_VER=`rpm -qpR honeycomb*.rpm | grep -oP 'vpp = \K.+'`
66     if [ "${HC_VPP_VER}" != "" ]; then
67         VER=${HC_VPP_VER}.x86_64
68     fi
69 else
70     HC_VPP_VER=`dpkg -I honeycomb*.deb | grep -oP 'vpp \(= \K[^\)]+'`
71     if [ "${HC_VPP_VER}" != "" ]; then
72         VER=${HC_VPP_VER}_amd64
73     fi
74 fi
75
76 # download VPP packages
77 for ART in ${VPP_ARTIFACTS}; do
78     for PAC in ${PACKAGE}; do
79         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
80     done
81 done
82
83 # verify downloaded package
84 if [ "${OS}" == "centos7" ]; then
85     FILES=*.rpm
86 else
87     FILES=*.deb
88 fi
89
90 for FILE in ${FILES}; do
91     echo " "${FILE} >> ${FILE}.md5
92 done
93 for MD5FILE in *.md5; do
94     md5sum -c ${MD5FILE} || exit
95     rm ${MD5FILE}
96 done