Skip to content

Commit d4ef315

Browse files
committed
add optional and team gate examples
Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>
1 parent 47f1234 commit d4ef315

28 files changed

Lines changed: 367 additions & 2 deletions

File tree

tasks/owners.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,29 @@ def smp_preselect(_, config_dir, changed_files, exclude="", owners_file=".github
9090
(matching the SMP CLI's discovery), addressed by its path relative to
9191
config_dir (e.g. "logs", "logs/syslog"). Ownership is resolved from the
9292
checked-out CODEOWNERS on both sides, so the result depends only on the PR.
93+
94+
Only folders whose README declares `mode: team-gate` participate in
95+
auto-selection; `mode: optional` (or a missing mode) folders are never
96+
auto-selected -- they remain plain opt-in checkboxes in the comment.
9397
"""
9498
import os
99+
import re
95100

96101
def _teams(owner_tuples):
97102
# keep TEAM entries only (drop individual users), normalized to bare slugs
98103
return {team.casefold().replace("@datadog/", "") for label, team in owner_tuples if label == 'TEAM'}
99104

105+
def _mode(rel):
106+
# read `mode:` from the folder README frontmatter; default "optional"
107+
try:
108+
with open(os.path.join(config_dir, rel, "README.md")) as f:
109+
content = f.read()
110+
except OSError:
111+
return "optional"
112+
block = re.search(r'^---\s*$(.*?)^---\s*$', content, re.MULTILINE | re.DOTALL)
113+
match = re.search(r'^\s*mode:\s*(\S+)', block.group(1) if block else content, re.MULTILINE)
114+
return match.group(1).strip().casefold() if match else "optional"
115+
100116
code_owners = read_owners(owners_file)
101117

102118
with open(changed_files) as f:
@@ -112,6 +128,8 @@ def _teams(owner_tuples):
112128
rel = os.path.relpath(root, config_dir)
113129
if rel == "." or rel.split(os.sep)[0] in excluded:
114130
continue
131+
if _mode(rel) != "team-gate":
132+
continue
115133
if _teams(code_owners.of(f"{config_dir}/{rel}/")) & involved_teams:
116134
selected.append(rel)
117135

test/regression/logs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
2-
description: Agent log-collection pipeline experiments (throughput & memory).
2+
description: Agent log-collection pipeline experiment suites (owned by agent-log-pipelines).
33
---
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
description: Core log-pipeline experiments — always run when the logs team is a codeowner on the PR.
3+
mode: team-gate
4+
---

test/regression/logs/cases/logs_example/datadog-agent/conf.d/disk-listener.d/conf.yaml renamed to test/regression/logs/general/cases/logs_general/datadog-agent/conf.d/disk-listener.d/conf.yaml

File renamed without changes.

test/regression/logs/cases/logs_example/datadog-agent/datadog.yaml renamed to test/regression/logs/general/cases/logs_general/datadog-agent/datadog.yaml

File renamed without changes.

test/regression/logs/cases/logs_example/experiment.yaml renamed to test/regression/logs/general/cases/logs_general/experiment.yaml

File renamed without changes.

test/regression/logs/cases/logs_example/lading/lading.yaml renamed to test/regression/logs/general/cases/logs_general/lading/lading.yaml

File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
description: Stateful log-pipeline experiments — opt in when relevant.
3+
mode: optional
4+
---

test/regression/metrics/cases/metrics_example/datadog-agent/conf.d/disk-listener.d/conf.yaml renamed to test/regression/logs/stateful/cases/logs_stateful/datadog-agent/conf.d/disk-listener.d/conf.yaml

File renamed without changes.

test/regression/metrics/cases/metrics_example/datadog-agent/datadog.yaml renamed to test/regression/logs/stateful/cases/logs_stateful/datadog-agent/datadog.yaml

File renamed without changes.

0 commit comments

Comments
 (0)