added function to read runner script

This commit is contained in:
brb
2023-07-06 15:53:15 +02:00
parent 9102d03ef4
commit c1aa6f3c41
+12 -1
View File
@@ -1,9 +1,12 @@
from pydantic import AnyHttpUrl
from typing import List
from pathlib import Path
from git import Repo
import logging
import shutil
import os
import yaml
from runner_script import RunnerScript
def clone_repository(repo_url: AnyHttpUrl) -> Path:
# extract repo name
@@ -18,4 +21,12 @@ def clone_repository(repo_url: AnyHttpUrl) -> Path:
# git clone repo
Repo.clone_from(url=repo_url, to_path=dst_dir)
logging.debug('finished')
return dst_dir
return dst_dir
def load_runner_script(path: Path) -> RunnerScript:
assert path.exists()
with open(path, 'r') as fh:
script = yaml.safe_load(fh)
runner_script = RunnerScript.parse_obj(script)
return runner_script