Make sure logfiles get posted after the status embed
This commit is contained in:
parent
653d66db40
commit
d5491731f4
@ -20,7 +20,7 @@ class APISession(Session):
|
|||||||
url = self.base_url + url
|
url = self.base_url + url
|
||||||
return super().request(method, url, *args, **kwargs)
|
return super().request(method, url, *args, **kwargs)
|
||||||
|
|
||||||
|
logfile_webhook = None
|
||||||
webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True)
|
webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True)
|
||||||
|
|
||||||
success = environ["CI_PIPELINE_STATUS"] != "failure"
|
success = environ["CI_PIPELINE_STATUS"] != "failure"
|
||||||
@ -67,6 +67,7 @@ webhook.add_embed(DiscordEmbed(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if not success:
|
if not success:
|
||||||
|
logfile_webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True)
|
||||||
with APISession(environ["PLUGIN_WOODPECKER_URL"].rstrip("/")) as client:
|
with APISession(environ["PLUGIN_WOODPECKER_URL"].rstrip("/")) as client:
|
||||||
client.headers.setdefault("Authorization", f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}")
|
client.headers.setdefault("Authorization", f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}")
|
||||||
|
|
||||||
@ -102,3 +103,7 @@ except KeyError:
|
|||||||
|
|
||||||
pprint(webhook.json)
|
pprint(webhook.json)
|
||||||
webhook.execute()
|
webhook.execute()
|
||||||
|
|
||||||
|
if logfile_webhook is not None:
|
||||||
|
pprint(logfile_webhook.json)
|
||||||
|
logfile_webhook.execute()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user