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>
This commit is contained in:

committed by
Marge Bot

parent
6a92af158d
commit
db6541a41a
@@ -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)
|
||||
|
Reference in New Issue
Block a user