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

Author: Eric Engestrom <e...@igalia.com>
Date:   Mon Nov  6 16:26:22 2023 +0000

bin/gitlab_gql: fix --print-merged-yaml when --rev != HEAD

Reading the local root config file and then asking gitlab to evaluate it
in the context of some other version will cause issues if they are not
identical.

Instead, the local document should be a simple include of whatever is
the root config file at that commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26074>

---

 bin/ci/gitlab_gql.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/ci/gitlab_gql.py b/bin/ci/gitlab_gql.py
index 3f422d5d10a..64d44f09678 100755
--- a/bin/ci/gitlab_gql.py
+++ b/bin/ci/gitlab_gql.py
@@ -12,6 +12,7 @@ from itertools import accumulate
 from os import getenv
 from pathlib import Path
 from subprocess import check_output
+from textwrap import dedent
 from typing import Any, Iterable, Optional, Pattern, TypedDict, Union
 
 import yaml
@@ -349,9 +350,10 @@ def print_dag(dag: Dag) -> None:
 
 
 def fetch_merged_yaml(gl_gql: GitlabGQL, params) -> dict[str, Any]:
-    gitlab_yml_file = get_project_root_dir() / ".gitlab-ci.yml"
-    content = Path(gitlab_yml_file).read_text().strip()
-    params["content"] = content
+    params["content"] = dedent("""\
+    include:
+      - local: .gitlab-ci.yml
+    """)
     raw_response = gl_gql.query("job_details.gql", params)
     if merged_yaml := raw_response["ciConfig"]["mergedYaml"]:
         return yaml.safe_load(merged_yaml)

Reply via email to