Skip to content

Commit

Permalink
feat: add 'project' and 'trust-domain' to set of tags applied to all …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ahal committed Sep 26, 2024
1 parent a0ff0bf commit 8343e67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/taskgraph/transforms/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
)

Expand Down
9 changes: 9 additions & 0 deletions test/test_transforms_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 8343e67

Please sign in to comment.