X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fapex%2Fapex-download-artifact.sh;h=e1e51b3b6d1bc9821e1bdd299af762530ac2db9d;hb=ab84a40af3b3141f05c8e99fc31b47cac35d73ce;hp=860cd60a54ba426d0b29b00af64303675f34bc2e;hpb=ede0336258973c16ec2ba557ec7c8a2bc2cc8168;p=releng.git diff --git a/jjb/apex/apex-download-artifact.sh b/jjb/apex/apex-download-artifact.sh index 860cd60a5..e1e51b3b6 100755 --- a/jjb/apex/apex-download-artifact.sh +++ b/jjb/apex/apex-download-artifact.sh @@ -10,18 +10,29 @@ echo [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY +if [ -z "$DEPLOY_SCENARIO" ]; then + echo "Deploy scenario not set!" + exit 1 +else + echo "Deploy scenario: ${DEPLOY_SCENARIO}" +fi + if [[ "$ARTIFACT_VERSION" =~ dev ]]; then - # dev build - GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$') - export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}" - # get build artifact - pushd ${BUILD_DIRECTORY} > /dev/null - echo "Downloading packaged dev build: apex-${OPNFV_ARTIFACT_VERSION}.tar.gz" - curl --fail -s -o $BUILD_DIRECTORY/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz - tar -xvf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz - popd > /dev/null + if [ "$BRANCH" == 'master' ]; then + echo "Skipping download of artifacts for master branch" + else + # dev build + GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$') + export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}" + # get build artifact + pushd ${BUILD_DIRECTORY} > /dev/null + echo "Downloading packaged dev build: apex-${OPNFV_ARTIFACT_VERSION}.tar.gz" + curl --fail -s -o $BUILD_DIRECTORY/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz + tar -xvf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz + popd > /dev/null + fi else - echo "Will download RPMs..." + echo "Will use RPMs..." # Must be RPMs/ISO echo "Downloading latest properties file" @@ -33,25 +44,36 @@ else source $BUILD_DIRECTORY/opnfv.properties RPM_INSTALL_PATH=$(echo "http://"$OPNFV_RPM_URL | sed 's/\/'"$(basename $OPNFV_RPM_URL)"'//') - RPM_LIST=${RPM_INSTALL_PATH}/$(basename $OPNFV_RPM_URL) - + RPM_LIST=$(basename $OPNFV_RPM_URL) # find version of RPM VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-([0-9]{8}|[a-z]+-[0-9]\.[0-9]+)') - # build RPM List which already includes base Apex RPM - RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm" - RPM_LIST+=" ${RPM_INSTALL_PATH}/python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm" + if [ "$BRANCH" != 'master' ]; then + # build RPM List which already includes base Apex RPM + RPM_LIST+=" opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm" + RPM_LIST+=" python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm" + fi # remove old / install new RPMs - if rpm -q opnfv-apex > /dev/null; then + if rpm -q python34-opnfv-apex > /dev/null; then INSTALLED_RPMS=$(rpm -qa | grep apex) if [ -n "$INSTALLED_RPMS" ]; then sudo yum remove -y ${INSTALLED_RPMS} fi fi + # Create an rpms dir on slave + mkdir -p ~/apex_rpms + pushd ~/apex_rpms + # Remove older rpms which do not match this version + find . ! -name "*${VERSION_EXTENSION}.noarch.rpm" -type f -exec rm -f {} + + # Download RPM only if changed on server + for rpm in $RPM_LIST; do + wget -N ${RPM_INSTALL_PATH}/${rpm} + done if ! sudo yum install -y $RPM_LIST; then echo "Unable to install new RPMs: $RPM_LIST" exit 1 fi + popd fi # TODO: Uncomment these lines to verify SHA512SUMs once the sums are