ci/bin: Fix gitlab_gql methods that uses needs DAG

Some gitlab_gql.py features like `--print-dag` were affected by recent
changes. Update those functions with the refactored data.

Fixes: c7b67d8619
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
This commit is contained in:
Guilherme Gallo 2023-10-28 00:49:12 -03:00 committed by Marge Bot
parent 278fc1c22a
commit b87e092489
2 changed files with 18 additions and 2 deletions

View File

@ -460,6 +460,12 @@ def get_job_final_definition(job_name, merged_yaml, project_path, sha):
print(image)
def from_sha_to_pipeline_iid(gl_gql: GitlabGQL, params) -> str:
result = gl_gql.query("pipeline_utils.gql", params)
return result["project"]["pipelines"]["nodes"][0]["iid"]
def parse_args() -> Namespace:
parser = ArgumentParser(
formatter_class=ArgumentDefaultsHelpFormatter,
@ -499,10 +505,11 @@ def parse_args() -> Namespace:
def main():
args = parse_args()
gl_gql = GitlabGQL(token=args.gitlab_token)
args.iid = from_sha_to_pipeline_iid(gl_gql, {"projectPath": args.project_path, "sha": args.sha})
if args.print_dag:
dag, jobs = create_job_needs_dag(
gl_gql, {"projectPath": args.project_path, "sha": args.sha}
dag = create_job_needs_dag(
gl_gql, {"projectPath": args.project_path, "iid": args.iid}, disable_cache=True
)
if args.regex:

View File

@ -0,0 +1,9 @@
query sha2pipelineIID($projectPath: ID!, $sha: String!) {
project(fullPath: $projectPath) {
pipelines(last: 1, sha:$sha){
nodes {
iid
}
}
}
}