From 22961fc45ab3f7b8de64a7d3c57f950c88538f53 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 6 Nov 2023 18:34:05 +0000 Subject: [PATCH] bin/gitlab_gql: deduplicate fetch_merged_yaml() logic between print branches Part-of: --- bin/ci/gitlab_gql.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/bin/ci/gitlab_gql.py b/bin/ci/gitlab_gql.py index 45510cf7a31..512a5edc95a 100755 --- a/bin/ci/gitlab_gql.py +++ b/bin/ci/gitlab_gql.py @@ -522,22 +522,21 @@ def main(): if args.regex: dag = filter_dag(dag, re.compile(args.regex)) + print_dag(dag) - if args.print_merged_yaml: - print( - fetch_merged_yaml( - gl_gql, {"projectPath": args.project_path, "sha": sha} - ) - ) - - if args.print_job_manifest: + if args.print_merged_yaml or args.print_job_manifest: merged_yaml = fetch_merged_yaml( gl_gql, {"projectPath": args.project_path, "sha": sha} ) - print_job_final_definition( - args.print_job_manifest, merged_yaml, args.project_path, sha - ) + + if args.print_merged_yaml: + print(merged_yaml) + + if args.print_job_manifest: + print_job_final_definition( + args.print_job_manifest, merged_yaml, args.project_path, sha + ) if __name__ == "__main__":