jjb: Add env and os details printing to build jobs
[lttng-ci.git] / scripts / lttng-tools / gerrit-depends-on.sh
index 062323bfb50c3f84279b76761605d7863d2cf93c..b8bcd4e9a30d6b07da061534bcaa6adbf7918c30 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -exu
+#!/bin/bash
 # shellcheck disable=SC2103
 #
 # Copyright (C) 2020 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+set -exu
+
 #Required variables
 GERRIT_NAME=${GERRIT_NAME:-}
 WORKSPACE=${WORKSPACE:-}
@@ -25,7 +27,7 @@ gerrit_url="https://${GERRIT_NAME}"
 gerrit_query="?o=CURRENT_REVISION&o=DOWNLOAD_COMMANDS"
 gerrit_json_query=".revisions[.current_revision].ref"
 
-possible_depends_on="lttng-ust"
+possible_depends_on="lttng-ust|lttng-modules"
 re="Depends-on: (${possible_depends_on}): ([^'$'\n'']*)"
 property_file="${WORKSPACE}/gerrit_custom_dependencies.properties"
 
@@ -36,9 +38,14 @@ touch "$property_file"
 pushd "${WORKSPACE}/src/lttng-tools"
 
 git rev-list --format=%B --max-count=1 HEAD | while read -r line; do
+    # Deactivate debug mode to prevent the gcc warning publisher from picking up
+    # compiler error present in the commit message.
+    set +x
     if ! [[ ${line} =~ ${re} ]]; then
+        set -x
         continue
     fi
+    set -x
 
     project=${BASH_REMATCH[1]}
     gerrit_id=${BASH_REMATCH[2]}
@@ -50,6 +57,17 @@ git rev-list --format=%B --max-count=1 HEAD | while read -r line; do
         continue
     fi
 
+    if [ "$project" = "lttng-modules" ]; then
+        if [ -d "$WORKSPACE/src/lttng-modules" ]; then
+            # Remove the regular modules sources to replace them with those
+           # from the gerrit change
+            rm -rf "$WORKSPACE/src/lttng-modules"
+        else
+            # This job does not require modules sources
+            continue
+       fi
+    fi
+
     # Export the GERRIT_DEP_... into the property file for further jenkins usage
     echo "GERRIT_DEP_${project_sanitize^^}=${gerrit_id}" >> "$property_file"
 
This page took 0.025599 seconds and 4 git commands to generate.