Skip to content
Snippets Groups Projects
Commit ec69fb2f authored by s2870355's avatar s2870355
Browse files

added checking for failed jobs

parent 63be5a8d
No related branches found
No related tags found
No related merge requests found
Pipeline #68953 passed
......@@ -66,7 +66,7 @@ def get_new_job(info : list[dict]) -> dict:
return i
return None
def run_cli_sequential(job : dict) -> None:
def run_cli_sequential(job : dict) -> int:
return subprocess.call(args=["docker", "run", "--rm", "-v", f"{dir_path}:/usr/src/project", "-it", job['image'], "bash", os.path.join("/usr/src/project/",os.path.relpath(job['location'] , dir_path)).replace("\\", "/")])
def remove_from_depends(process_info : dict, jobname : str) -> dict:
......@@ -75,15 +75,23 @@ def remove_from_depends(process_info : dict, jobname : str) -> dict:
return process_info
def run_ci(compile_info : list[dict]) -> list:
def run_ci(compile_info : list[dict]) -> bool:
print(compile_info)
jobs = []
failed_jobs = []
while len(jobs) != 0 or can_run_jon(compile_info):
new_job = get_new_job(compile_info)
print(f"compiling: {new_job['location']}")
run_cli_sequential(new_job)
code = run_cli_sequential(new_job)
compile_info.remove(new_job)
compile_info = [remove_from_depends(r, new_job['location']) for r in compile_info]
if code != 0:
failed_jobs.append(new_job['location'])
if len(failed_jobs) != 0:
print(f"failed {len(failed_jobs)} jobs:\n\t{failed_jobs}")
return False
return True
def job_to_string(job : list[dict]):
name : str = job['location'].replace(os.path.sep, '-')
......@@ -139,4 +147,5 @@ if "--ci" in sys.argv:
with open(os.path.join(dir_path, "gitlab-ci-generated.yml"), 'w') as ci:
ci.write(generate_ci(compile_info=process_sh(files_sh=get_all_sh())).replace("\t", " "))
else:
run_ci(compile_info=process_sh(files_sh=get_all_sh()))
if run_ci(compile_info=process_sh(files_sh=get_all_sh())) != True:
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment