Skip to content

Commit 1a1e79c

Browse files
Merge branch 'main' into schema-conversion
2 parents 1d23c98 + 7a1303a commit 1a1e79c

File tree

13 files changed

+71
-33
lines changed

13 files changed

+71
-33
lines changed

CHANGELOG.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
# Change Log
22

3+
## [15.1.0] - 2025-08-29
4+
5+
### Added
6+
7+
- New function `taskgraph.generator.load_tasks_for_kinds` to get multiple kinds in one pass
8+
- Allow the `os-groups` generic-worker feature on linux and mac
9+
10+
### Fixed
11+
12+
- taskgraph build-image regression introduced in 14.6.0
13+
314
## [15.0.1] - 2025-08-14
415

5-
## Reverted
16+
### Reverted
617

718
- multiprocess kind processing (#746)
819

920
## [15.0.0] - 2025-08-13
1021

11-
## Added
22+
### Added
1223

1324
- Process kinds in parallel with a pool of processes (#738)
1425
- use `uv` to check python version, when available(#733)
1526

16-
## Changed
27+
### Changed
1728

1829
- BREAKING CHANGE: Use `primary-dependency-label` attribute to find primary dependency of tasks (#736)
1930

20-
## Fixed
31+
### Fixed
2132

2233
- Fallback to guessing repo root in config.py (#742)
2334

CONTRIBUTING.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,16 @@ In order to release a new version of Taskgraph, you will need to:
157157

158158
1. Update ``CHANGELOG.md``
159159
2. Update ``version`` in ``pyproject.toml``
160-
3. Commit, and land the above changes with a commit message like "chore: bump <version>"
161-
4. Draft a release in Github pointing to the above commit.
160+
3. Run ``uv lock``
161+
4. Commit, and land the above changes with a commit message like "chore: bump <version>"
162+
5. Draft a release in Github pointing to the above commit.
162163

163164
a. Create a new tag of the form ``X.Y.Z``
164165
b. Ensure "Set as latest release" is checked
165166
c. Submit the release
166167

167-
5. Wait for the ``pypi-publish`` Github workflow and ``push-image-decision`` task to finish.
168-
6. Verify that expected version has been published to `pypi
168+
6. Wait for the ``pypi-publish`` Github workflow and ``push-image-decision`` task to finish.
169+
7. Verify that expected version has been published to `pypi
169170
<https://pypi.org/project/taskcluster-taskgraph>`__ and pushed to `DockerHub`_.
170171

171172
.. _DockerHub: https://hub.docker.com/r/mozillareleases/taskgraph/tags
@@ -176,7 +177,7 @@ Releasing pytest-taskgraph
176177
There's also a Pytest plugin packaged under ``packages/pytest-taskgraph``. The
177178
release process for this package is:
178179

179-
1. Update ``version`` in ``packages/pytest-taskgraph/pyproject.toml``
180+
1. Update ``version`` in ``packages/pytest-taskgraph/pyproject.toml``, and run ``uv lock``
180181
2. Commit and land the changes with a commit message like "chore: bump pytest-taskgraph <version>"
181182
3. Draft a release in Github pointing to the above commit.
182183

packages/pytest-taskgraph/src/pytest_taskgraph/fixtures/gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def fake_loader(kind, path, config, parameters, loaded_tasks):
3030
"attributes": {"_tasknum": str(i)},
3131
"task": {
3232
"i": i,
33-
"metadata": {"name": f"t-{i}"},
33+
"metadata": {"name": f"{kind}-t-{i}"},
3434
"deadline": "soon",
3535
},
3636
"dependencies": dependencies,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### Project
22
[project]
33
name = "taskcluster-taskgraph"
4-
version = "15.0.1"
4+
version = "15.1.0"
55
description = "Build taskcluster taskgraphs"
66
readme = "README.rst"
77
authors = [

src/taskgraph/generator.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def _run(self):
374374
if parameters["enable_always_target"]:
375375
always_target_tasks = {
376376
t.label
377-
for t in full_task_graph.tasks.values() # type: ignore
377+
for t in full_task_graph.tasks.values()
378378
if t.attributes.get("always_target")
379379
if parameters["enable_always_target"] is True
380380
or t.kind in parameters["enable_always_target"]
@@ -388,7 +388,7 @@ def _run(self):
388388
target_graph = full_task_graph.graph.transitive_closure(requested_tasks)
389389
target_task_graph = TaskGraph(
390390
{l: all_tasks[l] for l in target_graph.nodes},
391-
target_graph, # type: ignore
391+
target_graph,
392392
)
393393
yield self.verify(
394394
"target_task_graph", target_task_graph, graph_config, parameters
@@ -446,19 +446,28 @@ def verify(self, name, *args, **kwargs):
446446
return name, args[0]
447447

448448

449-
def load_tasks_for_kind(parameters, kind, root_dir=None):
449+
def load_tasks_for_kinds(parameters, kinds, root_dir=None):
450450
"""
451-
Get all the tasks of a given kind.
451+
Get all the tasks of the given kinds.
452452
453453
This function is designed to be called from outside of taskgraph.
454454
"""
455455
# make parameters read-write
456456
parameters = dict(parameters)
457-
parameters["target-kinds"] = [kind]
457+
parameters["target-kinds"] = kinds
458458
parameters = parameters_loader(spec=None, strict=False, overrides=parameters)
459459
tgg = TaskGraphGenerator(root_dir=root_dir, parameters=parameters)
460460
return {
461461
task.task["metadata"]["name"]: task
462462
for task in tgg.full_task_set
463-
if task.kind == kind
463+
if task.kind in kinds
464464
}
465+
466+
467+
def load_tasks_for_kind(parameters, kind, root_dir=None):
468+
"""
469+
Get all the tasks of a given kind.
470+
471+
This function is designed to be called from outside of taskgraph.
472+
"""
473+
return load_tasks_for_kinds(parameters, [kind], root_dir)

src/taskgraph/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,10 @@ def build_image(args):
590590
graph_config = load_graph_config(root)
591591

592592
if args["context_only"] is None:
593-
build_image(args["image_name"], args["tag"], os.environ, graph_config)
593+
build_image(args["image_name"], args["tag"], graph_config, os.environ)
594594
else:
595595
build_context(
596-
args["image_name"], args["context_only"], os.environ, graph_config
596+
args["image_name"], args["context_only"], graph_config, os.environ
597597
)
598598

599599

src/taskgraph/taskgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __contains__(self, label):
4141

4242
def __iter__(self):
4343
"Iterate over tasks in undefined order"
44-
return iter(self.tasks.values()) # type: ignore
44+
return iter(self.tasks.values())
4545

4646
def to_json(self):
4747
"Return a JSON-able object representing the task graph, as documented"

src/taskgraph/transforms/task.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,6 @@ def set_defaults(config, tasks):
869869
elif worker["implementation"] == "generic-worker":
870870
worker.setdefault("env", {})
871871
worker.setdefault("os-groups", [])
872-
if worker["os-groups"] and worker["os"] != "windows":
873-
raise Exception(
874-
"os-groups feature of generic-worker is only supported on "
875-
"Windows, not on {}".format(worker["os"])
876-
)
877872
worker.setdefault("chain-of-trust", False)
878873
elif worker["implementation"] in (
879874
"scriptworker-signing",

src/taskgraph/util/cached_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def add_optimization(
3737
"""
3838
if (digest is None) == (digest_data is None):
3939
raise Exception("Must pass exactly one of `digest` and `digest_data`.")
40-
if digest is None:
41-
digest = hashlib.sha256("\n".join(digest_data).encode("utf-8")).hexdigest() # type: ignore
40+
elif digest is None and digest_data is not None:
41+
digest = hashlib.sha256("\n".join(digest_data).encode("utf-8")).hexdigest()
4242

4343
if "cached-task-prefix" in config.graph_config["taskgraph"]:
4444
cache_prefix = config.graph_config["taskgraph"]["cached-task-prefix"]

src/taskgraph/util/schema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import pprint
77
from typing import List
8+
import re
9+
from collections.abc import Mapping
810

911
import msgspec
1012

@@ -192,6 +194,7 @@ def resolve_keyed_by(
192194
]
193195

194196

197+
195198
class Schema(msgspec.Struct, kw_only=True, omit_defaults=True, rename="kebab"):
196199
"""
197200
Base schema class that extends msgspec.Struct.

0 commit comments

Comments
 (0)