ci/lava: Fix LAVA job validation

When jobs.validate returns something, it means that there is a dict
filled with the error message, so we were running the job with some
validation errors for a quite while

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15938>
This commit is contained in:
Guilherme Gallo 2022-03-23 19:26:47 -03:00 committed by Marge Bot
parent 6a3ee3ea32
commit 75410c3d76
1 changed files with 3 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import urllib.parse
import xmlrpc
from datetime import datetime, timedelta
from os import getenv
from typing import Optional
import lavacli
import yaml
@ -226,7 +227,7 @@ class LAVAJob():
def heartbeat(self):
self.last_log_time = datetime.now()
def validate(self):
def validate(self) -> Optional[dict]:
try:
return _call_proxy(
self.proxy.scheduler.jobs.validate, self.definition, True
@ -386,7 +387,7 @@ def main(args):
if args.validate_only:
job = LAVAJob(proxy, job_definition)
ret = job.validate()
if not ret:
if ret:
fatal_err("Error in LAVA job definition")
print("LAVA job definition validated successfully")
return