added function to read runner script
This commit is contained in:
+12
-1
@@ -1,9 +1,12 @@
|
|||||||
from pydantic import AnyHttpUrl
|
from pydantic import AnyHttpUrl
|
||||||
|
from typing import List
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from git import Repo
|
from git import Repo
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
import yaml
|
||||||
|
from runner_script import RunnerScript
|
||||||
|
|
||||||
def clone_repository(repo_url: AnyHttpUrl) -> Path:
|
def clone_repository(repo_url: AnyHttpUrl) -> Path:
|
||||||
# extract repo name
|
# extract repo name
|
||||||
@@ -18,4 +21,12 @@ def clone_repository(repo_url: AnyHttpUrl) -> Path:
|
|||||||
# git clone repo
|
# git clone repo
|
||||||
Repo.clone_from(url=repo_url, to_path=dst_dir)
|
Repo.clone_from(url=repo_url, to_path=dst_dir)
|
||||||
logging.debug('finished')
|
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
|
||||||
|
|
||||||
Reference in New Issue
Block a user