Do not start builds after initialization success.

Since they start quickly it is better to let users
start them when needed, to avoid stopping
builds that are actually used in favor
of new builds they may not be needed by users.
This commit is contained in:
Stéphane Bidoul 2021-11-20 15:19:01 +01:00
parent ea6b37a0eb
commit 22575f0e35
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92

View file

@ -289,11 +289,11 @@ class Build(BaseModel):
async def on_initialize_succeeded(self) -> None: async def on_initialize_succeeded(self) -> None:
if self.init_status == BuildInitStatus.succeeded: if self.init_status == BuildInitStatus.succeeded:
# Avoid restarting stopped deployments when the controller is notified of # Already marked as succeeded. We are probably here because the controller
# succeeded old initialization jobs after a controller restart. # is restarting, and is notified of existing initialization jobs.
return return
_logger.info(f"Initialization job succeded for {self}, starting.") _logger.info(f"Initialization job succeded for {self}, ready to start.")
if await self._patch(init_status=BuildInitStatus.succeeded, desired_replicas=1): if await self._patch(init_status=BuildInitStatus.succeeded):
await github.notify_status( await github.notify_status(
self.repo, self.repo,
self.git_commit, self.git_commit,