From: Michael Tremer Date: Thu, 9 Mar 2023 22:56:54 +0000 (+0000) Subject: builds: Move updating repositories from jobs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa2af191983e5fe516c63b255adadeb28ff439bb;p=pbs.git builds: Move updating repositories from jobs Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index e51cbf50..0a0a4fa0 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -435,6 +435,10 @@ class Build(base.DataObject): if self.has_finished(): return + # On success, update all repositories + if not job.has_failed(): + await self._update_repos() + # If all jobs have finished, the build has finished elif all((j.has_finished() for j in self.jobs)): return await self.finished(success=True) @@ -626,6 +630,14 @@ class Build(base.DataObject): return list(repos) + async def _update_repos(self): + """ + This method should be called if the repositories should be updated + """ + await asyncio.gather( + *(repo.has_changed() for repo in self.repos), + ) + ## Bugs def get_bug_ids(self): diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index d9c22c24..054e70d0 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -313,12 +313,6 @@ class Job(base.DataObject): # Propagate any changes to the build await self.build._job_finished(job=self) - # On success, update all repositories - if success: - await asyncio.gather( - *(repo.has_changed() for repo in self.build.repos), - ) - def is_running(self): """ Returns True if this job is running