From 8343e67a820fae5dd0a988d85897237cf9ce15dd Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Thu, 26 Sep 2024 10:29:36 -0400 Subject: [PATCH] feat: add 'project' and 'trust-domain' to set of tags applied to all tasks Task tags will show up in the Firefox-CI ETL, so adding these tags will make it possible to group costs by project and trust domain respectively. Note that Taskgraph is already inconsistent with the global tags it applies. There is `worker-implementation` and `createdForUser`. I decided to use dashes instead of camel case, but don't have a strong preference. We should make the tag format consistent, but that's a breaking change which I'll leave for another time. --- src/taskgraph/transforms/task.py | 2 ++ test/test_transforms_task.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/taskgraph/transforms/task.py b/src/taskgraph/transforms/task.py index eb68b333..9733e41d 100644 --- a/src/taskgraph/transforms/task.py +++ b/src/taskgraph/transforms/task.py @@ -1114,6 +1114,8 @@ def build_task(config, tasks): "createdForUser": config.params["owner"], "kind": config.kind, "label": task["label"], + "project": config.params["project"], + "trust-domain": config.graph_config["trust-domain"], } ) diff --git a/test/test_transforms_task.py b/test/test_transforms_task.py index 24e4c179..c4200308 100644 --- a/test/test_transforms_task.py +++ b/test/test_transforms_task.py @@ -43,6 +43,15 @@ def assert_common(task_dict): assert "extra" in task_dict["task"] assert "payload" in task_dict["task"] assert "routes" in task_dict["task"] + assert task_dict["task"].get("tags", {}) == { + "createdForUser": "some-owner", + "kind": "test", + "label": "test-fake-task-name", + "os": "linux", + "project": "some-project", + "trust-domain": "test-domain", + "worker-implementation": "docker-worker", + } assert ( "index.test-domain.v2.some-project.latest.fake.fake-job" in task_dict["task"]["routes"]