From b69d40af590dee8672dc725c3f07808db45a3e3e Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 4 Dec 2019 15:44:00 +0100 Subject: [PATCH] [FIX] runbot: ignore rebuilds in _find_new_commits When rebuilding a build/subbuild, the last commit of the branch won't have the same sha of the branch last commit. find_new_commit will kill the running builds in the branch and create a new one, that may be a duplicate of one of the killed commits. This fix only take normal builds into account when checking for existing builds. --- runbot/models/repo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 2b6e99ba..431f5e35 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -267,7 +267,7 @@ class runbot_repo(models.Model): self.env.cr.execute(""" SELECT DISTINCT ON (branch_id) name, branch_id - FROM runbot_build WHERE branch_id in %s ORDER BY branch_id,id DESC; + FROM runbot_build WHERE branch_id in %s AND build_type = 'normal' ORDER BY branch_id,id DESC; """, (tuple([ref_branches[r[0]] for r in refs]),)) # generate a set of tuples (branch_id, sha) builds_candidates = {(r[1], r[0]) for r in self.env.cr.fetchall()} @@ -293,6 +293,7 @@ class runbot_repo(models.Model): 'committer_email': committer_email, 'subject': subject, 'date': dateutil.parser.parse(date[:19]), + 'build_type': 'normal', } if not branch.sticky: # pending builds are skipped as we have a new ref