Skip to content
Snippets Groups Projects
Unverified Commit c2c9daa0 authored by Pablo Correa Gomez's avatar Pablo Correa Gomez :beach:
Browse files

mrhlpr: pipeline: add support for Alpine's dynamic dowstream pipelines

Fixes #30
parent aeb2cb28
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ class GitLabOrigin:
username: Optional[str]
def download_json(origin: GitLabOrigin, pathname: str, no_cache: bool = False) -> dict[str, Any]:
def download_json(origin: GitLabOrigin, pathname: str, no_cache: bool = False) -> Any:
"""Download and parse JSON from an API, with a cache.
:param origin: gitlab origin information, see gitlab.parse_git_origin()
......
......@@ -30,6 +30,18 @@ class PipelineMetadata:
f" status '{pipeline_status}' instead of 'success'"
)
if origin.project == "alpine":
trigger_jobs = gitlab.download_json(
origin,
f"/projects/{pipeline_project_id}/pipelines/{pipeline_id}/bridges",
True,
)
if trigger_jobs:
if len(trigger_jobs) != 1:
raise RuntimeError(f"Unexpected number of jobs: got {trigger_jobs} instead of 1")
pipeline_id = trigger_jobs[0]["downstream_pipeline"]["id"]
pipeline_project_id = trigger_jobs[0]["downstream_pipeline"]["project_id"]
# Query the jobs of the pipeline (without cache, the result may change e.g.
# if this ran earlier while the pipeline was not successful and now it is)
api_pipeline_jobs = gitlab.download_json(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment