HC Test: Test jobs for 17.01
[csit.git] / resources / tools / download_hc_build_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2016 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 -ex
17
18 trap 'rm -f *.deb.md5; exit' EXIT
19 trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR
20 STREAM=$1
21
22 # Download the latest VPP .deb packages, their matching JVPP .jar and VPP plugin .deb packages
23 URL="https://nexus.fd.io/service/local/artifact/maven/content"
24 VER="LATEST"
25 REPO="fd.io.${STREAM}.ubuntu.trusty.main"
26 VPP_GROUP="io.fd.vpp"
27 HC_GROUP="io.fd.hc2vpp"
28 NSH_GROUP="io.fd.nsh_sfc"
29 VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins"
30 HC_ARTIFACTS="honeycomb"
31 NSH_ARTIFACTS="vpp-nsh-plugin"
32 PACKAGE="deb deb.md5"
33 CLASS="deb"
34
35 if [ ${STREAM} == 'stable.1701' ]; then
36     JVPP_VER="17.01-SNAPSHOT"
37     JVPP_REPO="fd.io.snapshot"
38     JVPP_ARTIFACTS="jvpp-core jvpp-registry"
39     JVPP_PACKAGE="jar jar.md5"
40     for ART in ${JVPP_ARTIFACTS}; do
41         for PAC in $JVPP_PACKAGE; do
42             curl "${URL}?r=${JVPP_REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${JVPP_VER}" -O -J || exit
43         done
44     done
45     # Install JVPP to maven local repo, to be used in HC2VPP build
46     JVPP_JARS=$(find . -type f -iname '*.jar')
47     for item in jvpp*.jar; do
48         # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
49         # ArtifactId = jvpp-registry
50         # Version = 17.01
51         basefile=$(basename -s .jar "$item")
52         artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
53         version=$(echo "$basefile" | cut -d '-' -f 3)
54         mvn install:install-file -Dfile=${item} -DgroupId=io.fd.vpp -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
55     done
56 else
57     # After 17.01 JVPP jars are installed from "vpp-api-java" package
58     VPP_ARTIFACTS+=' vpp-api-java'
59 fi
60
61 for ART in ${VPP_ARTIFACTS}; do
62     for PAC in $PACKAGE; do
63         curl "${URL}?r=${REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
64     done
65 done
66
67 for ART in ${HC_ARTIFACTS}; do
68     for PAC in $PACKAGE; do
69         curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
70     done
71 done
72
73 for ART in ${NSH_ARTIFACTS}; do
74     for PAC in $PACKAGE; do
75         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
76     done
77 done
78
79 for FILE in *.deb; do
80     echo " "${FILE} >> ${FILE}.md5
81 done
82
83 for FILE in *.jar; do
84     echo " "${FILE} >> ${FILE}.md5
85 done
86
87 for MD5FILE in *.md5; do
88     md5sum -c ${MD5FILE} || exit
89 done