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

added cache and multiple artifacts

parent 4fdecf7b
No related branches found
No related tags found
No related merge requests found
Pipeline #70190 failed
......@@ -34,7 +34,9 @@ def extract_info(file_path : str) -> dict:
if line.startswith("#stage: "):
info["stage"] = line.removeprefix("#stage: ")
if line.startswith("#artifacts: "):
info["artifacts"] = os.path.join(os.path.dirname(info["location"]), line.removeprefix("#artifacts: ").replace('/', os.path.sep))
info["cache"] = normalize_depends(file_path,ast.literal_eval(line.removeprefix("#artifacts: ")))
if line.startswith("#cache: "):
info["cache"] = normalize_depends(file_path,ast.literal_eval(line.removeprefix("#cache: ")))
if line.startswith("#enable: false"):
return None
if "image" not in info:
......@@ -121,6 +123,10 @@ def job_to_string(job : list[dict]):
artifacts = job["artifacts"]
else:
artifacts = "untracked"
if "cache" in job:
cache = job["cache"]
else:
cache = None
image : str = job["image"]
script : str = "chmod +x " + job['location'] + " && " + "./" + job['location']
output: str = "\n"
......@@ -132,7 +138,13 @@ def job_to_string(job : list[dict]):
if artifacts == "untracked":
output = output + '\t' + 'artifacts:\n\t\tuntracked: true\n'
else:
output = output + '\t' + 'artifacts:\n\t\tpaths:\n\t\t\t- \"' + artifacts + '\"\n'
output = output + '\t' + 'artifacts:\n\t\tpaths:\n
for artifact in artifacts:
output = output + "\t\t\t- \"' + artifact + '\"\n'
if cache is not None:
output = output + '\t' + 'cache:\n\t\tpaths:\n
for c in cache:
output = output + "\t\t\t- \"' + c + '\"\n'
return output
def get_stages(compile_info : list[dict]) -> list[str]:
......
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