[FIX] runbot_merge: make staging cancels more greppable

I just spent 10mn trying to find out why staging 28 was cancelled
(a p=0 comment). Add a common prefix to all staging cancels to make
them easier to find.
This commit is contained in:
Xavier Morel 2018-09-21 15:58:30 +02:00
parent e6a1a0634a
commit 20bb058f06
3 changed files with 7 additions and 6 deletions

View File

@ -153,9 +153,9 @@ def handle_pr(env, event):
if pr_obj.state == 'ready':
pr_obj.staging_id.cancel(
"Updated PR %s:%s, removing staging %s",
"PR %s:%s updated by %s",
pr_obj.repository.name, pr_obj.number,
pr_obj.staging_id,
event['sender']['login']
)
if pr_obj.state != 'error':
pr_obj.state = 'opened'
@ -168,9 +168,9 @@ def handle_pr(env, event):
if event['action'] == 'closed' and pr_obj.state != 'merged':
pr_obj.state = 'closed'
pr_obj.staging_id.cancel(
"Closed PR %s:%s, removing staging %s",
"PR %s:%s closed by %s",
pr_obj.repository.name, pr_obj.number,
pr_obj.staging_id
event['sender']['login']
)
return 'Closed {}'.format(pr_obj.id)

View File

@ -564,7 +564,7 @@ class PullRequests(models.Model):
self.priority = param
if param == 0:
self.target.active_staging_id.cancel(
"P=0 on %s:%s by %s, unstaging %s",
"P=0 on %s:%s by %s, unstaging target %s",
self.repository.name, self.number,
author.github_login, self.target.name,
)
@ -821,7 +821,7 @@ class Stagings(models.Model):
if not self:
return
_logger.info(reason, *args)
_logger.info("Cancelling staging %s: " + reason, self, *args)
self.batch_ids.write({'active': False})
self.active = False

View File

@ -702,6 +702,7 @@ class Client(werkzeug.test.Client):
'action': action,
'pull_request': self._pr(pr),
'repository': self._repo(pr.repo.name),
'sender': {'login': '<>'},
**({'changes': changes} if changes else {})
}
))