6 # -o pipefail: Fail on errors in scripts this calls, give stacktrace
9 # Install required packages
11 # shellcheck disable=SC1091
12 source rpm_build/bin/activate
13 PYTHON="rpm_build/bin/python"
14 $PYTHON -m pip install --upgrade pip
15 $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
17 # Packaging logic needs a tarball, but can repackage a zip into tar.gz
18 # if needed. All builds except multipatch-test publish both a tar.gz and zip.
19 # Autorelease passes DOWNLOAD_URL to zip, others typically use tar.gz.
20 # If URL is to zip, check if there's a tar.gz available to avoid repackaging.
21 if [[ $DOWNLOAD_URL = *.zip ]]; then
22 # shellcheck disable=SC2154
23 candidate_tarball_url="${{DOWNLOAD_URL//zip/tar.gz}}"
24 # shellcheck disable=SC2154
25 url_status=$(curl --silent --head --location --output /dev/null --write-out \
26 '%{{http_code}}' "$candidate_tarball_url")
27 if [[ $url_status = 2* ]]; then
28 DOWNLOAD_URL="$candidate_tarball_url"
32 # Build release specified by build params
33 "$WORKSPACE/packaging/packages/build.py" --rpm \
34 --changelog_name "$CHANGELOG_NAME" \
35 --changelog_email "$CHANGELOG_EMAIL" \
37 --download_url "$DOWNLOAD_URL"
39 # Publish RPMs to Nexus if in production Jenkins, else host on sandbox Jenkins
40 if [ "$SILO" == "sandbox" ]; then
41 # TODO: Host RPMs on Jenkins temporarily
42 echo "Not uploading RPMs to Nexus because running in sandbox"
43 elif [ "$SILO" == "releng" ]; then
44 # Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
45 UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
46 mkdir -p "$UPLOAD_FILES_PATH"
47 mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
48 mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
50 echo "Unknown Jenkins silo: $SILO"