Merge "Move openflowplugin Sonar scan to Sonarcloud"
[releng/builder.git] / jjb / packaging / build-deb.sh
1 #!/bin/bash
2
3 # Options:
4 #   -x: Echo commands
5 #   -e: Fail on errors
6 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
7 set -ex -o pipefail
8
9 # Install required packages
10 virtualenv deb_build
11 # shellcheck disable=SC1091
12 source deb_build/bin/activate
13 PYTHON="deb_build/bin/python"
14 $PYTHON -m pip install --upgrade pip
15 $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
16
17 # Build release specified by build params
18 "$WORKSPACE/packaging/packages/build.py" --deb \
19                                          --changelog_name "$CHANGELOG_NAME" \
20                                          --changelog_email "$CHANGELOG_EMAIL" \
21                                          direct \
22                                          --download_url "$DOWNLOAD_URL"
23
24 # Publish debs to Nexus if in production Jenkins, else host on sandbox Jenkins
25 if [ "$SILO" == "sandbox" ]; then
26   # TODO: Host debs on Jenkins temporarily
27   echo "Not uploading debs to Nexus because running in sandbox"
28 elif  [ "$SILO" == "releng" ]; then
29   # Copy the debs to be upload
30   # Move debs to dir of files that will be uploaded to Nexus
31   UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
32   mkdir -p "$UPLOAD_FILES_PATH"
33   # Note: no source packages are available, since the debs are not built
34   # from the actual source
35   ln -s "$WORKSPACE/packaging/packages/deb/opendaylight/"*.deb "$_"
36 else
37   echo "Unknown Jenkins silo: $SILO"
38   exit 1
39 fi