Merge "Use PUBLIC_BRIDGE instead of hardcoded br-physnet1"
[releng/builder.git] / jjb / autorelease / include-raw-autorelease-notify-build-failure.sh
index 645b70456308dd4adb9977dd52598c2c9ed75352..e50ec453c0d791b3401413e8df4313ef900878e1 100644 (file)
@@ -54,26 +54,33 @@ ARTIFACT_ID=$(awk -F: '/\[ERROR\].*mvn <goals> -rf :/ { print $2}' $CONSOLE_LOG)
 #     project.groupId is not set but IS inherited from project.parent.groupId
 # else
 #     exclude project mailing list
-grouplist=()
-while IFS="" read -r p; do
-    GROUP=$(xmlstarlet sel\
-          -N "x=http://maven.apache.org/POM/4.0.0"\
-          -t -m "/x:project[x:artifactId='$ARTIFACT_ID']"\
-          --if "/x:project/x:groupId"\
-          -v "/x:project/x:groupId"\
-          --elif "/x:project/x:parent/x:groupId"\
-          -v "/x:project/x:parent/x:groupId"\
-          --else -o ""\
-          "$p" 2>/dev/null)
-    if [ ! -z "${GROUP}" ]; then
-        grouplist+=($(echo "${GROUP}" | awk -F'.' '{ print $3 }'))
+if [ ! -z "$ARTIFACT_ID" ]; then
+    grouplist=()
+    while IFS="" read -r p; do
+        GROUP=$(xmlstarlet sel\
+              -N "x=http://maven.apache.org/POM/4.0.0"\
+              -t -m "/x:project[x:artifactId='$ARTIFACT_ID']"\
+              --if "/x:project/x:groupId"\
+              -v "/x:project/x:groupId"\
+              --elif "/x:project/x:parent/x:groupId"\
+              -v "/x:project/x:parent/x:groupId"\
+              --else -o ""\
+              "$p" 2>/dev/null)
+        if [ ! -z "${GROUP}" ]; then
+            grouplist+=($(echo "${GROUP}" | awk -F'.' '{ print $3 }'))
+        fi
+    done < <(find . -name "pom.xml")
+
+    if [ "${#grouplist[@]}" -eq 1 ]; then
+        PROJECT="${grouplist[0]}"
+    elif [ "${#grouplist[@]}" -gt 1 ]; then
+        GROUPLIST="NOTE: The artifactId: $ARTIFACT_ID matches multiple groups: ${grouplist[*]}"
+    else
+        echo "Failed to determine project.groupId using xpaths"
     fi
-done < <(find . -name "pom.xml")
-
-if [ "${#grouplist[@]}" -eq 1 ]; then
-    PROJECT="${grouplist[0]}"
 else
-    GROUPLIST="NOTE: The artifactId: $ARTIFACT_ID matches multiple groups: ${grouplist[*]}"
+    echo "Failed to determine ARTIFACT_ID"
+    exit 1
 fi
 
 # Construct email subject & body