bin/gitlab_gql: only get the pipeline when a pipeline is needed

Otherwise, options like --print-merged-yaml are broken when their
commit's push didn't create a pipeline.

Fixes: b87e092489 ("ci/bin: Fix gitlab_gql methods that uses needs DAG")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26142>
This commit is contained in:
Eric Engestrom
2023-11-10 10:47:56 +00:00
committed by Marge Bot
parent 325d650c6e
commit f4f4d80096

View File

@@ -509,11 +509,10 @@ def main():
sha = check_output(['git', 'rev-parse', args.sha]).decode('ascii').strip()
args.iid = from_sha_to_pipeline_iid(gl_gql, {"projectPath": args.project_path, "sha": sha})
if args.print_dag:
iid = from_sha_to_pipeline_iid(gl_gql, {"projectPath": args.project_path, "sha": sha})
dag = create_job_needs_dag(
gl_gql, {"projectPath": args.project_path, "iid": args.iid}, disable_cache=True
gl_gql, {"projectPath": args.project_path, "iid": iid}, disable_cache=True
)
if args.regex: