aboutsummaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorLoys Ollivier <lollivier@baylibre.com>2017-11-08 14:03:21 +0100
committerLoys Ollivier <lollivier@baylibre.com>2017-11-08 14:03:21 +0100
commiteb128da8fdda07d8f8f74ff941961992a9a52adc (patch)
treec1b4ebae021fa113dd76314508ed42e989970d47 /jjb
parent41f2a94135443b239d3335949726b4223d8c2f3d (diff)
CIBT improve lava lab searching and coding style
Fix coding style, indentation. Improve the lab search, if a lab has the device do not search in others as it won't be used. Change-Id: I7471511ff7af3d2f6d8708943b42099a450ef770 Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/common/include-agl-lava-jobs-submit.sh18
-rw-r--r--jjb/common/include-agl-lava-labs-prepare.sh38
-rw-r--r--jjb/common/include-agl-run-test-short.sh17
3 files changed, 35 insertions, 38 deletions
diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh
index e7aed028..8ab3df15 100644
--- a/jjb/common/include-agl-lava-jobs-submit.sh
+++ b/jjb/common/include-agl-lava-jobs-submit.sh
@@ -42,8 +42,8 @@ for device_type in $device_types; do
echo -n "Checking for $device_type at $full_url... "
line=$(lava-tool devices-list $full_url |grep $device_type | tr -d '[:space:]')
if [ -z "$line" ]; then
- echo "not found."
- continue
+ echo "not found."
+ continue
fi
IFS='|'
arr=($line)
@@ -53,16 +53,16 @@ for device_type in $device_types; do
# device is only available if "idle" or "running"
device_available=0
if [ x"$device_status" = x"idle" ]; then
- device_available=1
+ device_available=1
elif [ x"$device_status" = x"running" ]; then
- device_available=1;
+ device_available=1;
fi
if [ $device_available = 0 ]; then
- echo " Not Available. Status: $device_status"
- continue
+ echo " Not Available. Status: $device_status"
+ continue
else
- echo " Found and available. Status: $device_status"
+ echo " Found and available. Status: $device_status"
fi
# Need to hack the real device-type name in the job file
@@ -101,9 +101,9 @@ for device_type in $device_types; do
# after one successful submit, we're done
if [ x"$status" = x"Complete" ]; then
- exit 0
+ exit 0
else
- continue
+ continue
fi
done
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh
index bc590600..b54fc223 100644
--- a/jjb/common/include-agl-lava-labs-prepare.sh
+++ b/jjb/common/include-agl-lava-labs-prepare.sh
@@ -6,12 +6,16 @@
#
# Uses user/token pairs from Jenkins secrets
#
+# And macthing LAVA lab names for releng-scripts
+#
+# Strucuture: [JENKINS_LAB_NAME]="LAB_URL;JENKINS_LAB_USER;JENKINS_LAB_TOKEN;RELENG_LAB_NAME"
+#
declare -A labs
labs=(
- [agl]="https://lava.automotivelinux.org/;$LAB_AGL_USER;$LAB_AGL_TOKEN"
- [baylibre]="http://lava.baylibre.com:10080/;$LAB_BAYLIBRE_USER;$LAB_BAYLIBRE_TOKEN"
+ [agl]="https://lava.automotivelinux.org/;$LAB_AGL_USER;$LAB_AGL_TOKEN;lab-agl-core"
+ [baylibre]="http://lava.baylibre.com:10080/;$LAB_BAYLIBRE_USER;$LAB_BAYLIBRE_TOKEN;lab-baylibre-legacy"
# [baylibre_seattle]="http://lava.ished.com/;$LAB_BAYLIBRE_SEATTLE_USER;$LAB_BAYLIBRE_SEATTLE_TOKEN"
- )
+)
echo "## ${MACHINE} ##"
__MACHINE=${MACHINE%-nogfx}
@@ -37,15 +41,16 @@ for lab in "${!labs[@]}"; do
url=${arr[0]}
user=${arr[1]}
token=${arr[2]}
+ lava_lab=${arr[3]}
token_file=$HOME/.local/lab-$lab-token
if [ -z ${user} ]; then
- echo "WARNING: Lab ${lab}: missing user. Ignoring."
- continue
+ echo "WARNING: Lab ${lab}: missing user. Ignoring."
+ continue
fi
if [ -z ${token} ]; then
- echo "WARNING: Lab ${lab}: missing token. Ignoring."
- continue
+ echo "WARNING: Lab ${lab}: missing token. Ignoring."
+ continue
fi
# LAVA URL with username
@@ -56,7 +61,7 @@ for lab in "${!labs[@]}"; do
echo ${token} > $token_file
lava-tool auth-add --token $token_file $full_url
if [ $? != 0 ]; then
- echo "ERROR: Lab ${lab}: lava-tool auth-add failed."
+ echo "ERROR: Lab ${lab}: lava-tool auth-add failed."
fi
rm -f $token_file
@@ -64,8 +69,8 @@ for lab in "${!labs[@]}"; do
echo -n "Checking for $__MACHINE at $full_url... "
line=$(lava-tool devices-list $full_url |grep $__MACHINE | tr -d '[:space:]')
if [ -z "$line" ]; then
- echo "not found."
- continue
+ echo "not found."
+ continue
fi
IFS='|'
arr=($line)
@@ -75,16 +80,17 @@ for lab in "${!labs[@]}"; do
# device is only available if "idle" or "running"
device_available=0
if [ x"$device_status" = x"idle" ]; then
- device_available=1
+ device_available=1
elif [ x"$device_status" = x"running" ]; then
- device_available=1;
+ device_available=1;
fi
if [ $device_available = 0 ]; then
- echo " Not Available. Status: $device_status"
- continue
+ echo " Not Available. Status: $device_status"
+ continue
else
- echo " Found and available. Status: $device_status"
- export LAVA_LAB=$lab
+ echo " Found and available. Status: $device_status"
+ export LAVA_LAB=$lava_lab
+ break
fi
done
diff --git a/jjb/common/include-agl-run-test-short.sh b/jjb/common/include-agl-run-test-short.sh
index fda2da9e..68b412ad 100644
--- a/jjb/common/include-agl-run-test-short.sh
+++ b/jjb/common/include-agl-run-test-short.sh
@@ -7,25 +7,16 @@
set -x
-#
-# LAVA lab names for releng-scripts
-#
-declare -A lava_labs
-lava_labs=(
- [agl]="lab-agl-core"
- [baylibre]="lab-baylibre-legacy"
- )
-
echo "## ${MACHINE} ##"
-echo "# ${lava_labs[$LAVA_LAB]} #"
cd $REPODIR
# WIP: use $RELENG for subset of boards
__MACHINE=${MACHINE%-nogfx} # releng doesn't care
if [ ! -z $RELENG ] && \
[[ x$__MACHINE == x"qemux86-64" || \
- x$__MACHINE == x"raspberrypi3" || \
- x$__MACHINE == x"m3ulcb" ]]; then
+ x$__MACHINE == x"raspberrypi3" || \
+ x$__MACHINE == x"m3ulcb" ]]; then
+ echo "# LAVA lab target: ${LAVA_LAB} #"
# releng-scripts depends on jinja2 >= 2.9
echo "## Check version of python-jinja2: "
pip show jinja2
@@ -38,7 +29,7 @@ if [ ! -z $RELENG ] && \
[[ -e output/repo-manifest-r.txt.sha1 ]] && BUILD_VERSION+="-$(cat output/repo-manifest-r.txt.sha1)"
CREATE_ARGS+="--name AGL-gerrit "
CREATE_ARGS+="--build-version $BUILD_VERSION "
- CREATE_ARGS+="--callback ${lava_labs[$LAVA_LAB]} "
+ CREATE_ARGS+="--callback ${LAVA_LAB} "
CREATE_ARGS+="--test all"
$RELENG/utils/create-jobs.py ${CREATE_ARGS} > testjob.yaml
cat testjob.yaml