Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions utils/scripts/ci_orchestrators/external_gitlab_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,22 @@ 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn’t remove this if. Take a look at the method comment: if it’s None or not a language, the pipeline will be generated for all languages.

Checking the usages: https://github.com/search?q=org%3ADataDog%20external_gitlab_pipeline.py&type=code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to condition I added to is_allowed_stage to match the old one. The only thing that should change is that jobs not related to SSI should no longer be included in the pipeline export.

Comment thread
nccatoni marked this conversation as resolved.

handle_parallelism(data)

# Print the modified YAML
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
Expand Down
Loading