7 echo "Downloading the Apex artifact. This could take some time..."
8 echo "--------------------------------------------------------"
11 [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
13 if [ -z "$DEPLOY_SCENARIO" ]; then
14 echo "Deploy scenario not set!"
17 echo "Deploy scenario: ${DEPLOY_SCENARIO}"
20 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
21 if [[ "$BRANCH" != 'stable/fraser' ]]; then
22 echo "Skipping download of artifacts for master/gambia branch"
25 GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$')
26 export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}"
28 pushd ${BUILD_DIRECTORY} > /dev/null
29 echo "Downloading packaged dev build: apex-${OPNFV_ARTIFACT_VERSION}.tar.gz"
30 curl --fail -s -o $BUILD_DIRECTORY/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
31 tar -xvf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
35 echo "Will use RPMs..."
38 echo "Downloading latest properties file"
40 # get the properties file in order to get info regarding artifacts
41 curl --fail -s -o $BUILD_DIRECTORY/opnfv.properties http://$GS_URL/latest.properties
43 # source the file so we get OPNFV vars
44 source $BUILD_DIRECTORY/opnfv.properties
46 RPM_INSTALL_PATH=$(echo "http://"$OPNFV_RPM_URL | sed 's/\/'"$(basename $OPNFV_RPM_URL)"'//')
47 RPM_LIST=$(basename $OPNFV_RPM_URL)
49 VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-([0-9]{8}|[a-z]+-[0-9]\.[0-9]+)')
50 if [ "$BRANCH" == 'stable/fraser' ]; then
51 # build RPM List which already includes base Apex RPM
52 RPM_LIST+=" opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm"
53 RPM_LIST+=" python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm"
56 # remove old / install new RPMs
57 if rpm -q python34-opnfv-apex > /dev/null; then
58 INSTALLED_RPMS=$(rpm -qa | grep apex)
59 if [ -n "$INSTALLED_RPMS" ]; then
60 sudo yum remove -y ${INSTALLED_RPMS}
63 # Create an rpms dir on slave
66 # Remove older rpms which do not match this version
67 find . ! -name "*${VERSION_EXTENSION}.noarch.rpm" -type f -exec rm -f {} +
68 # Download RPM only if changed on server
69 for rpm in $RPM_LIST; do
70 wget -N ${RPM_INSTALL_PATH}/${rpm}
72 if ! sudo yum install -y $RPM_LIST; then
73 echo "Unable to install new RPMs: $RPM_LIST"
79 # TODO: Uncomment these lines to verify SHA512SUMs once the sums are
81 # echo "$OPNFV_ARTIFACT_SHA512SUM $BUILD_DIRECTORY/apex.iso" | sha512sum -c
82 # echo "$OPNFV_RPM_SHA512SUM $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL)" | sha512sum -c
85 ls -al $BUILD_DIRECTORY
88 echo "--------------------------------------------------------"