X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fpackaging%2Fbuild-rpm.sh;h=da0fdcf6d275e0d36530d47bd238551e74d55b99;hb=d5fb457479b8760a272adb35212aa275042598e4;hp=e5066a498036564a9aac8333529ed9d1f4b3e3b5;hpb=bd32472a51ac51ff19a6ae707ad3eca5d71d7432;p=releng%2Fbuilder.git diff --git a/jjb/packaging/build-rpm.sh b/jjb/packaging/build-rpm.sh index e5066a498..da0fdcf6d 100644 --- a/jjb/packaging/build-rpm.sh +++ b/jjb/packaging/build-rpm.sh @@ -14,6 +14,18 @@ PYTHON="rpm_build/bin/python" $PYTHON -m pip install --upgrade pip $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt" +# Verify artifact at DOWNLOAD_URL exists +# shellcheck disable=SC2154 +url_status=$(curl --silent --head --location --output /dev/null --write-out \ + '%{http_code}' "$DOWNLOAD_URL") +if [[ $url_status = 2* ]]; then + echo "Artifact at DOWNLOAD_URL exists" +else + echo "Artifact at DOWNLOAD_URL does not exist" + exit 1 +fi + + # Packaging logic needs a tarball, but can repackage a zip into tar.gz # if needed. All builds except multipatch-test publish both a tar.gz and zip. # Autorelease passes DOWNLOAD_URL to zip, others typically use tar.gz. @@ -34,18 +46,28 @@ fi --changelog_name "$CHANGELOG_NAME" \ --changelog_email "$CHANGELOG_EMAIL" \ direct \ - --download_url "$DOWNLOAD_URL" + --download_url "$DOWNLOAD_URL" \ + --pkg_version "$PKG_VERSION_OVERRIDE" -# Publish RPMs to Nexus if in production Jenkins, else host on sandbox Jenkins -if [ "$SILO" == "sandbox" ]; then - echo "Not uploading RPMs to Nexus because running in sandbox" -elif [ "$SILO" == "releng" ]; then +# Always allow push to scratch repos, only push to CD repos in RelEng Jenkins +if [ "$DEPLOY_TO_REPO" == "opendaylight-epel-7-x86_64-devel" ]; then # Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus UPLOAD_FILES_PATH="$WORKSPACE/upload_files" mkdir -p "$UPLOAD_FILES_PATH" cp "$HOME/rpmbuild/RPMS/noarch/"*.rpm "$_" cp "$HOME/rpmbuild/SRPMS/"*.rpm "$_" else - echo "Unknown Jenkins silo: $SILO" - exit 1 + # Publish RPMs to CD repos if in production Jenkins, not in sandbox Jenkins + if [ "$SILO" == "sandbox" ]; then + echo "Not uploading RPMs to Nexus because running in sandbox" + elif [ "$SILO" == "releng" ]; then + # Move RPMs (SRPM+noarch) to dir of files that will be uploaded to Nexus + UPLOAD_FILES_PATH="$WORKSPACE/upload_files" + mkdir -p "$UPLOAD_FILES_PATH" + cp "$HOME/rpmbuild/RPMS/noarch/"*.rpm "$_" + cp "$HOME/rpmbuild/SRPMS/"*.rpm "$_" + else + echo "Unknown Jenkins silo: $SILO" + exit 1 + fi fi