From 2a18ef41959c1561e67e871b4fa45c4d55d5750e Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 14 Aug 2019 17:07:29 +0200 Subject: [PATCH] [FIX] runbot: missing indirect In some case _force can return an empty recordset, if the corresponding branch is in no_build mode in other repo may be an explanation here. This commit avoid to stuck the fetch and build loop in this case. --- runbot/models/repo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 802f51ea..05d95e70 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -316,8 +316,11 @@ class runbot_repo(models.Model): if latest_rev_build: _logger.debug('Reverse dependency build %s forced in repo %s by commit %s', latest_rev_build.dest, rev_repo.name, sha[:6]) indirect = latest_rev_build._force(message='Rebuild from dependency %s commit %s' % (self.name, sha[:6])) - indirect.build_type = 'indirect' - new_build.revdep_build_ids += indirect + if not indirect: + _logger.exception('Failed to create indirect for %s from %s in repo %s', new_build, latest_rev_build, rev_repo) + else: + indirect.build_type = 'indirect' + new_build.revdep_build_ids += indirect # skip old builds (if their sequence number is too low, they will not ever be built) skippable_domain = [('repo_id', '=', self.id), ('local_state', '=', 'pending')]