Skip to content

Commit

Permalink
api: Allow run artifacts to include size
Browse files Browse the repository at this point in the history
Doing this in a backward compatible way for now.

Signed-off-by: Andy Doan <[email protected]>
  • Loading branch information
doanac committed Jun 5, 2023
1 parent 6d3ca0c commit 10bd6e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jobserv/api/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def run_get(proj, build_id, run):
r = _get_run(proj, build_id, run)
data = r.as_json(detailed=True)
artifacts = []
v2 = request.args.get("version") == "v2"
for a in Storage().list_artifacts(r):
u = url_for(
"api_run.run_get_artifact",
Expand All @@ -51,7 +52,10 @@ def run_get(proj, build_id, run):
path=a["name"],
_external=True,
)
artifacts.append(u)
if v2:
artifacts.append({"url": u, "size_bytes": a["size_bytes"]})
else:
artifacts.append(u)
data["artifacts"] = artifacts
return jsendify({"run": data})

Expand Down

0 comments on commit 10bd6e2

Please sign in to comment.