mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot: dont duplicate export
Even if it isn't really problematic, avoiding to duplicate exports will make the table slighly smaller, especially when considering running builds.
This commit is contained in:
parent
3985332a34
commit
c4d0b56972
@ -329,6 +329,8 @@ class BuildResult(models.Model):
|
|||||||
build_by_old_values = defaultdict(lambda: self.env['runbot.build'])
|
build_by_old_values = defaultdict(lambda: self.env['runbot.build'])
|
||||||
for record in self:
|
for record in self:
|
||||||
build_by_old_values[record.local_state] += record
|
build_by_old_values[record.local_state] += record
|
||||||
|
if values['local_state'] == 'done':
|
||||||
|
self.env['runbot.commit.export'].search([('build_id', 'in', self.ids)]).unlink()
|
||||||
local_result = values.get('local_result')
|
local_result = values.get('local_result')
|
||||||
for build in self:
|
for build in self:
|
||||||
if local_result and local_result != self._get_worst_result([build.local_result, local_result]): # dont write ok on a warn/error build
|
if local_result and local_result != self._get_worst_result([build.local_result, local_result]): # dont write ok on a warn/error build
|
||||||
@ -729,8 +731,6 @@ class BuildResult(models.Model):
|
|||||||
build._github_status()
|
build._github_status()
|
||||||
build._run_job()
|
build._run_job()
|
||||||
|
|
||||||
if build.local_state == 'done':
|
|
||||||
self.env['runbot.commit.export'].search([('build_id', '=', build.id)]).unlink()
|
|
||||||
|
|
||||||
def _run_job(self):
|
def _run_job(self):
|
||||||
# run job
|
# run job
|
||||||
|
@ -56,7 +56,8 @@ class Commit(models.Model):
|
|||||||
"""Export a git repo into a sources"""
|
"""Export a git repo into a sources"""
|
||||||
# TODO add automated tests
|
# TODO add automated tests
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
self.env['runbot.commit.export'].create({'commit_id': self.id, 'build_id': build.id})
|
if not self.env['runbot.commit.export'].search([('build_id', '=', build.id), ('commit_id', '=', self.id)]):
|
||||||
|
self.env['runbot.commit.export'].create({'commit_id': self.id, 'build_id': build.id})
|
||||||
export_path = self._source_path()
|
export_path = self._source_path()
|
||||||
|
|
||||||
if os.path.isdir(export_path):
|
if os.path.isdir(export_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user