Merge "Move dlux Sonar scan to Sonarcloud"
[releng/builder.git] / jjb / packaging / build-deb.sh
index 0602669128240ffc810b865283aa3be6de5b2643..1e43e5421050dddb3ddabe35a020868d577d5486 100644 (file)
@@ -6,23 +6,34 @@
 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
 set -ex -o pipefail
 
+# Install required packages
+virtualenv deb_build
+# shellcheck disable=SC1091
+source deb_build/bin/activate
+PYTHON="deb_build/bin/python"
+$PYTHON -m pip install --upgrade pip
+$PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
+
 # Build release specified by build params
-"$WORKSPACE/packaging/deb/build.py" --major "$VERSION_MAJOR" \
-                                  --minor "$VERSION_MINOR" \
-                                  --patch "$VERSION_PATCH" \
-                                  --deb "$PKG_VERSION" \
-                                  --sysd_commit "$SYSD_COMMIT" \
-                                  --codename "$CODENAME" \
-                                  --java_version "$JAVA_VERSION" \
-                                  --download_url "$DOWNLOAD_URL" \
-                                  --changelog_date "$CHANGELOG_DATE" \
-                                  --changelog_time "$CHANGELOG_TIME" \
-                                  --changelog_name "$CHANGELOG_NAME" \
-                                  --changelog_email "$CHANGELOG_EMAIL"
+"$WORKSPACE/packaging/packages/build.py" --deb \
+                                         --changelog_name "$CHANGELOG_NAME" \
+                                         --changelog_email "$CHANGELOG_EMAIL" \
+                                         direct \
+                                         --download_url "$DOWNLOAD_URL"
 
-# Copy the debs to be upload
-UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
-mkdir -p "$UPLOAD_FILES_PATH"
-# Note: no source packages are available, since the debs are not built
-# from the actual source
-mv "$WORKSPACE/packaging/deb/opendaylight/"*.deb "$_"
+# Publish debs to Nexus if in production Jenkins, else host on sandbox Jenkins
+if [ "$SILO" == "sandbox" ]; then
+  # TODO: Host debs on Jenkins temporarily
+  echo "Not uploading debs to Nexus because running in sandbox"
+elif  [ "$SILO" == "releng" ]; then
+  # Copy the debs to be upload
+  # Move debs to dir of files that will be uploaded to Nexus
+  UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+  mkdir -p "$UPLOAD_FILES_PATH"
+  # Note: no source packages are available, since the debs are not built
+  # from the actual source
+  ln -s "$WORKSPACE/packaging/packages/deb/opendaylight/"*.deb "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi