7 echo "Downloading the Apex artifact. This could take some time..."
8 echo "--------------------------------------------------------"
11 [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
13 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
15 GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$')
16 export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}"
18 pushd ${BUILD_DIRECTORY} > /dev/null
19 echo "Downloading packaged dev build: apex-${OPNFV_ARTIFACT_VERSION}.tar.gz"
20 curl --fail -s -o $BUILD_DIRECTORY/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
21 tar -xvf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
24 echo "Will use RPMs..."
27 echo "Downloading latest properties file"
29 # get the properties file in order to get info regarding artifacts
30 curl --fail -s -o $BUILD_DIRECTORY/opnfv.properties http://$GS_URL/latest.properties
32 # source the file so we get OPNFV vars
33 source $BUILD_DIRECTORY/opnfv.properties
35 RPM_INSTALL_PATH=$(echo "http://"$OPNFV_RPM_URL | sed 's/\/'"$(basename $OPNFV_RPM_URL)"'//')
36 RPM_LIST=$(basename $OPNFV_RPM_URL)
39 VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-([0-9]{8}|[a-z]+-[0-9]\.[0-9]+)')
40 # build RPM List which already includes base Apex RPM
41 RPM_LIST+=" opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm"
43 # add back legacy support for danube
44 if [ "$BRANCH" == 'stable/danube' ]; then
45 RPM_LIST+=" opnfv-apex-common-${VERSION_EXTENSION}.noarch.rpm"
47 RPM_LIST+=" python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm"
50 # remove old / install new RPMs
51 if rpm -q opnfv-apex > /dev/null; then
52 INSTALLED_RPMS=$(rpm -qa | grep apex)
53 if [ -n "$INSTALLED_RPMS" ]; then
54 sudo yum remove -y ${INSTALLED_RPMS}
57 # Create an rpms dir on slave
60 # Remove older rpms which do not match this version
61 find . ! -name "*${VERSION_EXTENSION}.noarch.rpm" -type f -exec rm -f {} +
62 # Download RPM only if changed on server
63 for rpm in $RPM_LIST; do
64 wget -N ${RPM_INSTALL_PATH}/${rpm}
66 if ! sudo yum install -y $RPM_LIST; then
67 echo "Unable to install new RPMs: $RPM_LIST"
73 # TODO: Uncomment these lines to verify SHA512SUMs once the sums are
75 # echo "$OPNFV_ARTIFACT_SHA512SUM $BUILD_DIRECTORY/apex.iso" | sha512sum -c
76 # echo "$OPNFV_RPM_SHA512SUM $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL)" | sha512sum -c
79 ls -al $BUILD_DIRECTORY
82 echo "--------------------------------------------------------"