ci/ci_gantt_chart: add option to save output to a file
Allow saving in html and in image formats. Signed-off-by: Helen Koike <helen.koike@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25793>
This commit is contained in:
@@ -114,6 +114,12 @@ def parse_args() -> None:
|
||||
description="Generate the Gantt chart from a given pipeline."
|
||||
)
|
||||
parser.add_argument("pipeline_url", type=str, help="URLs to the pipeline.")
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
type=str,
|
||||
help="Output file name. Use html ou image suffixes to choose the format.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--token",
|
||||
metavar="token",
|
||||
@@ -131,4 +137,10 @@ if __name__ == "__main__":
|
||||
|
||||
pipeline, _ = get_gitlab_pipeline_from_url(gl, args.pipeline_url)
|
||||
fig = generate_gantt_chart(pipeline)
|
||||
fig.show()
|
||||
if args.output and "htm" in args.output:
|
||||
fig.write_html(args.output)
|
||||
elif args.output:
|
||||
fig.update_layout(width=1000)
|
||||
fig.write_image(args.output)
|
||||
else:
|
||||
fig.show()
|
||||
|
Reference in New Issue
Block a user