From a374c2cba32414126099c4cec5ef98dcddad7005 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 31 Jul 2019 16:48:27 +0200 Subject: [PATCH] [FIX] runbot: fix indirect mechanism indirect state was writen on parent leading to unconsistent info. indirect was using last build regardless of build_type. Now, indirect will only use normal build to avoid red-chain after a sticky rebuild. --- runbot/models/repo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 5142296b..802f51ea 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -312,11 +312,12 @@ class runbot_repo(models.Model): if branch.sticky: for rev_repo in self.search([('dependency_ids', 'in', self.id)]): # find the latest build with the same branch name - latest_rev_build = Build.search([('repo_id.id', '=', rev_repo.id), ('branch_id.branch_name', '=', branch.branch_name)], order='id desc', limit=1) + latest_rev_build = Build.search([('build_type', '=', 'normal'), ('hidden', '=', 'False'), ('repo_id.id', '=', rev_repo.id), ('branch_id.branch_name', '=', branch.branch_name)], order='id desc', limit=1) 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]) - latest_rev_build.build_type = 'indirect' - new_build.revdep_build_ids += latest_rev_build._force(message='Rebuild from dependency %s commit %s' % (self.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 # 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')]