mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[FIX] runbot, runbot_cla: notify each repo of cla status
When a PR is a duplicate of a branch, only the branch CLA status are
update. The same issue for build status was fixed in commit 4f1a55da9
.
With this commit, there is new method than can be used in runbot_cla.
This method updates commit given status in each repo.
This commit is contained in:
parent
4f1a55da9b
commit
a0dd87e45b
@ -718,6 +718,14 @@ class runbot_build(models.Model):
|
||||
p = subprocess.Popen(cmd, stdout=out, stderr=out, preexec_fn=preexec_fn, shell=shell, env=env, close_fds=False)
|
||||
return p.pid
|
||||
|
||||
def _github_status_notify_all(self, status):
|
||||
"""Notify each repo with a status"""
|
||||
self.ensure_one()
|
||||
commits = {(b.repo_id, b.name) for b in self.search([('name', '=', self.name)])}
|
||||
for repo, commit_hash in commits:
|
||||
_logger.debug("github updating %s status %s to %s in repo %s", status['context'], commit_hash, status['state'], repo.name)
|
||||
repo._github('/repos/:owner/:repo/statuses/%s' % commit_hash, status, ignore_errors=True)
|
||||
|
||||
def _github_status(self):
|
||||
"""Notify github of failed/successful builds"""
|
||||
runbot_domain = self.env['runbot.repo']._domain()
|
||||
@ -734,16 +742,13 @@ class runbot_build(models.Model):
|
||||
desc += " (runtime %ss)" % (build.job_time,)
|
||||
else:
|
||||
continue
|
||||
commits = {(b.repo_id, b.name) for b in self.search([('name', '=', build.name)])}
|
||||
for repo, commit_hash in commits:
|
||||
status = {
|
||||
"state": state,
|
||||
"target_url": "http://%s/runbot/build/%s" % (runbot_domain, build.id),
|
||||
"description": desc,
|
||||
"context": "ci/runbot"
|
||||
}
|
||||
_logger.debug("github updating status %s to %s", build.name, state)
|
||||
repo._github('/repos/:owner/:repo/statuses/%s' % commit_hash, status, ignore_errors=True)
|
||||
status = {
|
||||
"state": state,
|
||||
"target_url": "http://%s/runbot/build/%s" % (runbot_domain, build.id),
|
||||
"description": desc,
|
||||
"context": "ci/runbot"
|
||||
}
|
||||
build._github_status_notify_all(status)
|
||||
|
||||
# Jobs definitions
|
||||
# They all need "build, lock_pathn log_path" parameters
|
||||
|
@ -38,6 +38,6 @@ class runbot_build(models.Model):
|
||||
"context": "legal/cla"
|
||||
}
|
||||
build._log('check_cla', 'CLA %s' % state)
|
||||
build.repo_id._github('/repos/:owner/:repo/statuses/%s' % build.name, status, ignore_errors=True)
|
||||
build._github_status_notify_all(status)
|
||||
# 0 is myself, -1 is everybody else, -2 nothing
|
||||
return -2
|
||||
|
Loading…
Reference in New Issue
Block a user