X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fpackaging%2Fbuild-rpm.sh;h=7613e521916e3843a471217ba52e5a48c59be033;hb=eeec1594ba258dba78e27033e1eb6a35b211a502;hp=4d411ff35003ad6813d12d8108a5e03e911afb57;hpb=b7a803d347805aff9db3989f67a7456304c7e0e6;p=releng%2Fbuilder.git diff --git a/jjb/packaging/build-rpm.sh b/jjb/packaging/build-rpm.sh index 4d411ff35..7613e5219 100644 --- a/jjb/packaging/build-rpm.sh +++ b/jjb/packaging/build-rpm.sh @@ -20,10 +20,10 @@ $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt" # If URL is to zip, check if there's a tar.gz available to avoid repackaging. if [[ $DOWNLOAD_URL = *.zip ]]; then # shellcheck disable=SC2154 - candidate_tarball_url="${{DOWNLOAD_URL//zip/tar.gz}}" + candidate_tarball_url="${DOWNLOAD_URL//zip/tar.gz}" # shellcheck disable=SC2154 url_status=$(curl --silent --head --location --output /dev/null --write-out \ - '%{{http_code}}' "$candidate_tarball_url") + '%{http_code}' "$candidate_tarball_url") if [[ $url_status = 2* ]]; then DOWNLOAD_URL="$candidate_tarball_url" fi @@ -36,8 +36,16 @@ fi direct \ --download_url "$DOWNLOAD_URL" -# 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" -mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_" -mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_" +# 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 + # 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/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_" + cp "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_" +else + echo "Unknown Jenkins silo: $SILO" + exit 1 +fi