Commit 006d95d8 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

fix: handle case where heptapod.trig isn't in the first pipeline

parent 287bf626061e
Pipeline #18452 failed with stages
in 14 seconds
......@@ -37,8 +37,36 @@ def download_heptapod_trig():
gl = gitlab.Gitlab('https://forge.extranet.logilab.fr', oauth_token=os.environ["GITLAB_TOKEN"])
logigraphe = gl.projects.get(426)
with open("heptapod.trig", "wb") as f:
f.write(logigraphe.artifact('branch/default', 'heptapod.trig', 'generate_dataset_for_heptapod'))
for pipeline in logigraphe.pipelines.list(as_list=False):
if pipeline.ref != "branch/default":
continue
job = [x for x in pipeline.jobs.list(all=True) if x.name == "generate_dataset_for_heptapod"]
if not job:
continue
job = logigraphe.jobs.get(job[0].id)
try:
artifacts_archive = zipfile.ZipFile(io.BytesIO(job.artifacts()))
except gitlab.exceptions.GitlabGetError:
# 404
continue
heptapod_trig = [x for x in artifacts_archive.filelist if x.filename == "heptapod.trig"]
if not heptapod_trig:
continue
content = artifacts_archive.read("heptapod.trig")
if not content:
continue
with open("heptapod.trig", "wb") as f:
f.write(content)
return
raise Exception("failed to find heptapod.trig")
def download_files_to_url_cache():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment