X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fapex%2Fapex-download-artifact.sh;h=c12406cdb34fb301f371fca8ca3198f76abac30d;hb=013ab627c0b7f43dda7bc6e8f654b50e8e9a64a3;hp=a921d61aa49c9a4056fc7a95abac015a1d3a8437;hpb=f6554da7e6a13f6183f9b58901765f979381820b;p=releng.git diff --git a/jjb/apex/apex-download-artifact.sh b/jjb/apex/apex-download-artifact.sh index a921d61aa..c12406cdb 100755 --- a/jjb/apex/apex-download-artifact.sh +++ b/jjb/apex/apex-download-artifact.sh @@ -3,38 +3,52 @@ set -o errexit set -o nounset set -o pipefail -APEX_PKGS="common undercloud" # removed onos for danube +# log info to console +echo "Downloading the Apex artifact. This could take some time..." +echo "--------------------------------------------------------" +echo [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY -if [[ "$ARTIFACT_VERSION" =~ dev ]]; then +# if upstream we do not need to download anything +if [[ "$DEPLOY_SCENARIO" =~ upstream ]]; then + echo "Upstream deployment detected, skipping download artifact" +elif [[ "$ARTIFACT_VERSION" =~ dev ]]; then # dev build - export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}${GERRIT_PATCHSET_NUMBER}" + 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..." + 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 else + echo "Will use RPMs..." + # Must be RPMs/ISO - export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d") + echo "Downloading latest properties file" # get the properties file in order to get info regarding artifacts - curl --fail -s -o $BUILD_DIRECTORY/opnfv.properties http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties + curl --fail -s -o $BUILD_DIRECTORY/opnfv.properties http://$GS_URL/latest.properties # source the file so we get OPNFV vars 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 - for pkg in ${APEX_PKGS}; do - RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}.noarch.rpm" - done + RPM_LIST+=" opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm" + + # add back legacy support for danube + if [ "$BRANCH" == 'stable/danube' ]; then + RPM_LIST+=" opnfv-apex-common-${VERSION_EXTENSION}.noarch.rpm" + else + RPM_LIST+=" python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm" + fi # remove old / install new RPMs if rpm -q opnfv-apex > /dev/null; then @@ -43,19 +57,20 @@ else 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 - - # log info to console - echo "Downloading the ISO artifact using URL http://$OPNFV_ARTIFACT_URL" - echo "--------------------------------------------------------" - echo - - # Download ISO - curl --fail -s -o $BUILD_DIRECTORY/apex.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1 - + popd fi # TODO: Uncomment these lines to verify SHA512SUMs once the sums are