Skip to content

Commit 94a1d68

Browse files
committed
Emit statuses for effects
1 parent ccaecb0 commit 94a1d68

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

buildbot_nix/buildbot_nix/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ def __init__(
9999
**kwargs,
100100
)
101101

102+
async def run(self):
103+
await CombinedBuildEvent.produce_event_for_build(
104+
self.master, CombinedBuildEvent.STARTED_NIX_EFFECTS, self.build, None
105+
)
106+
107+
results = await super().run()
108+
109+
await CombinedBuildEvent.produce_event_for_build(
110+
self.master, CombinedBuildEvent.FINISHED_NIX_EFFECTS, self.build, None
111+
)
112+
113+
return results
114+
115+
116+
102117
def createTriggerProperties(self, props: Any) -> Any: # noqa: N802
103118
return props
104119

buildbot_nix/buildbot_nix/nix_status_generator.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class CombinedBuildEvent(Enum):
2929
FINISHED_NIX_EVAL = "finished-nix-eval"
3030
STARTED_NIX_BUILD = "started-nix-build"
3131
FINISHED_NIX_BUILD = "finished-nix-build"
32+
STARTED_NIX_EFFECTS = "started-nix-effects"
33+
FINISHED_NIX_EFFECTS = "finished-nix-effects"
3234

3335
@staticmethod
3436
async def produce_event_for_build_requests_by_id(
@@ -223,6 +225,14 @@ async def generate(
223225
"nix-build",
224226
"generator",
225227
)
228+
case (
229+
CombinedBuildEvent.STARTED_NIX_EFFECTS
230+
| CombinedBuildEvent.FINISHED_NIX_EFFECTS
231+
):
232+
report["builds"][0]["properties"]["status_name"] = (
233+
"nix-effects",
234+
"generator"
235+
)
226236
case _:
227237
msg = f"Unexpected event: {event_typed}"
228238
raise ValueError(msg)
@@ -231,6 +241,7 @@ async def generate(
231241
case (
232242
CombinedBuildEvent.FINISHED_NIX_EVAL
233243
| CombinedBuildEvent.FINISHED_NIX_BUILD
244+
| CombinedBuildEvent.FINISHED_NIX_EFFECTS
234245
):
235246
report["builds"][0]["complete"] = True
236247
report["builds"][0]["complete_at"] = datetime.now(tz=UTC)

0 commit comments

Comments
 (0)