Merge "yaml file for bundle-based-reconciliaion script"
[releng/builder.git] / jenkins-scripts / system_type.sh
index 201f34f9ae29bcbf1edc2ec9ffa754c496412b14..c5b141afd47d859d9384915f0247f905c0bd2748 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/bash
-
-# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+# SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2016 The Linux Foundation and others.
 #
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 
-HOST=$(/usr/bin/hostname)
+HOST=$(/bin/hostname)
 SYSTEM_TYPE=''
 
-# We use a separator character of - for the slave parts
-IFS='-' read -r -a HOSTPARTS <<< "${HOST}"
-
-# slurp in the control scripts
-FILES=($(find . -maxdepth 1 -type f -iname '*.sh' -exec basename -s '.sh' {} \;))
-# remap into an associative array
-declare -A A_FILES
-for key in "${!FILES[@]}"
-do
-    A_FILES[${FILES[$key]}]="${key}"
-done
-
-# Find our system_type control script if possible
-for i in "${HOSTPARTS[@]}"
-do
-    if [ "${A_FILES[${i}]}" != "" ]
-    then
-        SYSTEM_TYPE=${i}
+IFS=','
+for i in "java-builder,builder" \
+         "builder,builder" \
+         "devstack,devstack" \
+         "docker,docker" \
+         "gbp,ubuntu-docker-ovs" \
+         "kubernetes,mininet-ubuntu" \
+         "robot,robot" \
+         "mininet,mininet-ubuntu"
+do set -- $i
+    if [[ $HOST == *"$1"* ]]; then
+        SYSTEM_TYPE="$2"
         break
     fi
 done