diff --git a/utils/scripts/ci_orchestrators/external_gitlab_pipeline.py b/utils/scripts/ci_orchestrators/external_gitlab_pipeline.py index 945879d5b02..fea0ae7aceb 100644 --- a/utils/scripts/ci_orchestrators/external_gitlab_pipeline.py +++ b/utils/scripts/ci_orchestrators/external_gitlab_pipeline.py @@ -70,8 +70,7 @@ def main(language: str | None = None) -> None: # Ensure 'variables' section exists and update with new values data.setdefault("variables", {}).update(new_variables) - if language and language in LANG_STAGES: - data = filter_yaml(data, language) + data = filter_yaml(data, language) handle_parallelism(data) @@ -79,12 +78,14 @@ def main(language: str | None = None) -> None: print(yaml.dump(data, default_flow_style=False, sort_keys=False)) -def is_allowed_stage(stage: str | None, language: str) -> bool: +def is_allowed_stage(stage: str | None, language: str | None) -> bool: """Check if a stage is allowed based on the language.""" + if not language or language not in LANG_STAGES: + return stage in LANG_STAGES or stage in {"configure", "pipeline-status"} return stage in {language, "configure", "pipeline-status"} -def filter_yaml(yaml_data: dict, language: str) -> dict: +def filter_yaml(yaml_data: dict, language: str | None) -> dict: """Filter the pipeline to run only the jobs for the specified language""" # Find all jobs where stage == language