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