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 <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25858>
This commit is contained in:

committed by
Marge Bot

parent
49b3118302
commit
c7b67d8619
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user