]> git.ipfire.org Git - pbs.git/commitdiff
builds: Add all watchers of a scratch build to the test builds
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Feb 2025 11:45:16 +0000 (11:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Feb 2025 11:45:16 +0000 (11:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builds.py

index ab518c350e909e71d57967c00c7f84aa7aa551d3..2f06a3cef2273f9c42d2de5934b45f9b1db049c3 100644 (file)
@@ -1201,6 +1201,9 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                if not builds:
                        return
 
+               # Fetch all watchers
+               watchers = await self.get_watchers()
+
                # Create a build group for all tests
                group = await self.backend.builds.create_group(
                        owner        = self.owner,
@@ -1212,7 +1215,7 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                        build = max(builds[name])
 
                        # Create a new test build
-                       await self.backend.builds.create(
+                       build = await self.backend.builds.create(
                                # Use the same build repository
                                repo    = self.repo,
                                package = build.pkg,
@@ -1221,6 +1224,10 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                                test    = True,
                        )
 
+                       # Add all watchers of the build to the test builds
+                       for watcher in watchers:
+                               await build.add_watcher(watcher.user)
+
                # Return the group
                return group