Module: Mesa
Branch: main
Commit: b87e092489037daf45a54641e655b6838536ec9f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b87e092489037daf45a54641e655b6838536ec9f

Author: Guilherme Gallo <guilherme.ga...@collabora.com>
Date:   Sat Oct 28 00:49:12 2023 -0300

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: c7b67d86191659c4c5b1adc0306e2a1381400178
Signed-off-by: Guilherme Gallo <guilherme.ga...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>

---

 bin/ci/gitlab_gql.py      | 11 +++++++++--
 bin/ci/pipeline_utils.gql |  9 +++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/bin/ci/gitlab_gql.py b/bin/ci/gitlab_gql.py
index b0299b07314..046b1e91be5 100755
--- a/bin/ci/gitlab_gql.py
+++ b/bin/ci/gitlab_gql.py
@@ -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:
diff --git a/bin/ci/pipeline_utils.gql b/bin/ci/pipeline_utils.gql
new file mode 100644
index 00000000000..65c2ec64ec4
--- /dev/null
+++ b/bin/ci/pipeline_utils.gql
@@ -0,0 +1,9 @@
+query sha2pipelineIID($projectPath: ID!, $sha: String!) {
+  project(fullPath: $projectPath) {
+    pipelines(last: 1, sha:$sha){
+      nodes {
+        iid
+      }
+    }
+  }
+}

Reply via email to