squad.sh: resilient LAVA job ID retrieval

Under heavy loads in the LAVA lab [1], job ID retrieval through squad
may yield invalid job id numbers as seen in [2] and below

    12:37:03 ++ curl --retry 4 'https://qa-reports.linaro.org/api/testjobs/4020286/?fields=job_id'
    12:37:05   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    12:37:05                                  Dload  Upload   Total   Spent    Left  Speed
    12:37:05
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100    15  100    15    0     0     40      0 --:--:-- --:--:-- --:--:--    40
    100    15  100    15    0     0     40      0 --:--:-- --:--:-- --:--:--    40
    12:37:05 + LAVAJOB_ID='{"job_id":null}'

This commit introduce a simple loop & sleep sequence, breaking the
loop either if ID is a valid number or max-tries.

[1] https://tf.validation.linaro.org/
[2] https://ci.staging.trustedfirmware.org/job/lsandov1-tf-a-builder/21995/console

Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
Change-Id: I93c9e81a150f87c850f35dbca547482f906a3829
1 file changed