diff options
author | Loys Ollivier <lollivier@baylibre.com> | 2017-11-07 15:35:21 +0100 |
---|---|---|
committer | Loys Ollivier <lollivier@baylibre.com> | 2017-11-07 15:54:28 +0100 |
commit | 41f2a94135443b239d3335949726b4223d8c2f3d (patch) | |
tree | 052e1a32cc23ae77f8c6dcd42883067e26eaa5dd /jjb/common/include-agl-lava-labs-prepare.sh | |
parent | be498bcfdd7c0c2a3e47de0d8f6a04d9ef455662 (diff) |
CIBT find the LAVA lab before calling releng
Add some logic to lava-labs-prepare:
- Search for the machine in the list of labs
- export the lab name if found
Call releng with the corresponding lab name in run-test-short
Send the job directly to the corresponding lab in lava-jobs-submit.
Keep the 'checking for device' in this script as well, just to make sure
the device is still available and can run the job. Otherwise the script
could be blocked there if the device status changes.
Change-Id: I50646b7fdb607cb9245a1d31e644eee45a2a2356
Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'jjb/common/include-agl-lava-labs-prepare.sh')
-rw-r--r-- | jjb/common/include-agl-lava-labs-prepare.sh | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh index e36fa662..bc590600 100644 --- a/jjb/common/include-agl-lava-labs-prepare.sh +++ b/jjb/common/include-agl-lava-labs-prepare.sh @@ -13,6 +13,9 @@ labs=( # [baylibre_seattle]="http://lava.ished.com/;$LAB_BAYLIBRE_SEATTLE_USER;$LAB_BAYLIBRE_SEATTLE_TOKEN" ) +echo "## ${MACHINE} ##" +__MACHINE=${MACHINE%-nogfx} + # # Ensure python_keyring is set to plaintext. Required for # non-interactive use @@ -48,7 +51,7 @@ for lab in "${!labs[@]}"; do # LAVA URL with username full_url=${url/:\/\//:\/\/${user}\@} echo "LAVA auth-add for lab: $lab, URL: $full_url" - + # LAVA auth using token echo ${token} > $token_file lava-tool auth-add --token $token_file $full_url @@ -56,4 +59,32 @@ for lab in "${!labs[@]}"; do echo "ERROR: Lab ${lab}: lava-tool auth-add failed." fi rm -f $token_file + + # Find the LAVA Lab that has the device available to run the job + 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 + fi + IFS='|' + arr=($line) + device_status=${arr[2]} + IFS=${OFS} + + # device is only available if "idle" or "running" + device_available=0 + if [ x"$device_status" = x"idle" ]; then + device_available=1 + elif [ x"$device_status" = x"running" ]; then + device_available=1; + fi + + if [ $device_available = 0 ]; then + echo " Not Available. Status: $device_status" + continue + else + echo " Found and available. Status: $device_status" + export LAVA_LAB=$lab + fi done |