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

Author: Guilherme Gallo <[email protected]>
Date:   Tue Oct 24 00:08:37 2023 -0300

ci/bin: Use iid instead of SHA in gitlab_gql

We were using sha to fetch the pipeline from GraphQL, but that leads to
wrong results when MR and branch pipelines exist. For example,
using pipeline-url as the MR pipeline:
- https://gitlab.freedesktop.org/gallo/mesa/-/pipelines/1017182
This would lead into the branch pipeline:
- https://gitlab.freedesktop.org/gallo/mesa/-/pipelines/1013189

Also simplify the GQL query, it had lots of unused data.

Signed-off-by: Guilherme Gallo <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25858>

---

 bin/ci/ci_run_n_monitor.py  |  8 +++---
 bin/ci/pipeline_details.gql | 61 +++------------------------------------------
 2 files changed, 7 insertions(+), 62 deletions(-)

diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py
index 5d36b86b24a..4ec1296626c 100755
--- a/bin/ci/ci_run_n_monitor.py
+++ b/bin/ci/ci_run_n_monitor.py
@@ -14,13 +14,13 @@ and show the job(s) logs.
 
 import argparse
 import re
-from subprocess import check_output
 import sys
 import time
 from collections import defaultdict
 from concurrent.futures import ThreadPoolExecutor
 from functools import partial
 from itertools import chain
+from subprocess import check_output
 from typing import Literal, Optional
 
 import gitlab
@@ -295,10 +295,10 @@ def parse_args() -> None:
     return args
 
 
-def find_dependencies(target_job: str, project_path: str, sha: str) -> 
set[str]:
+def find_dependencies(target_job: str, project_path: str, iid: int) -> 
set[str]:
     gql_instance = GitlabGQL()
     dag, _ = create_job_needs_dag(
-        gql_instance, {"projectPath": project_path.path_with_namespace, "sha": 
sha}
+        gql_instance, {"projectPath": project_path.path_with_namespace, "iid": 
iid}
     )
 
     target_dep_dag = filter_dag(dag, target_job)
@@ -352,7 +352,7 @@ if __name__ == "__main__":
         if args.target:
             print("🞋 job: " + Fore.BLUE + args.target + Style.RESET_ALL)
             deps = find_dependencies(
-                target_job=args.target, sha=REV, project_path=cur_project
+                target_job=args.target, iid=pipe.iid, project_path=cur_project
             )
         target_job_id, ret = monitor_pipeline(
             cur_project, pipe, args.target, deps, args.force_manual, 
args.stress
diff --git a/bin/ci/pipeline_details.gql b/bin/ci/pipeline_details.gql
index e735ed8d396..d514d259b6b 100644
--- a/bin/ci/pipeline_details.gql
+++ b/bin/ci/pipeline_details.gql
@@ -1,74 +1,19 @@
-fragment LinkedPipelineData on Pipeline {
-  id
-  iid
-  path
-  cancelable
-  retryable
-  userPermissions {
-    updatePipeline
-  }
-  status: detailedStatus {
-    id
-    group
-    label
-    icon
-  }
-  sourceJob {
-    id
-    name
-  }
-  project {
-    id
-    name
-    fullPath
-  }
-}
-
-query getPipelineDetails($projectPath: ID!, $sha: String!) {
+query getPipelineDetails($projectPath: ID!, $iid: ID!) {
   project(fullPath: $projectPath) {
     id
-    pipeline(sha: $sha) {
+    pipeline(iid: $iid) {
       id
       iid
       complete
-      downstream {
-        nodes {
-          ...LinkedPipelineData
-        }
-      }
-      upstream {
-        ...LinkedPipelineData
-      }
       stages {
         nodes {
-          id
-          name
-          status: detailedStatus {
-            id
-            action {
-              id
-              icon
-              path
-              title
-            }
-          }
+          name,
           groups {
             nodes {
-              id
-              status: detailedStatus {
-                id
-                label
-                group
-                icon
-              }
-              name
-              size
               jobs {
                 nodes {
                   id
                   name
-                  kind
-                  scheduledAt
                   needs {
                     nodes {
                       id

Reply via email to