From 0dc8b97a7be890fbd7c3424b20c0387fa8632612 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 29 Apr 2024 17:17:00 +0200 Subject: [PATCH] Disable trello build notification by default --- dotenv.example | 4 ++++ lib/obs.rb | 2 -- lib/slack.rb | 2 ++ lib/trello.rb | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dotenv.example b/dotenv.example index e8b4e83..197e13e 100644 --- a/dotenv.example +++ b/dotenv.example @@ -7,6 +7,10 @@ KURREN_NOTIFY_SLACK_OBS=true # Default: false KURREN_NOTIFY_SLACK_OPENQA=false +# Notify trello about failed OBS builds +# Default: false +KURREN_NOTIFY_TRELLO_OBS=false + ### openQA Configuration # Your openQA API key # Default: none (you need to set this) diff --git a/lib/obs.rb b/lib/obs.rb index 940e011..578d30a 100644 --- a/lib/obs.rb +++ b/lib/obs.rb @@ -27,8 +27,6 @@ def notify(status:) @trello.status = status @trello.notify - return unless ENV.fetch('KURREN_NOTIFY_SLACK_OBS', true) - slack_message = 'Build failed for obs-server. https://build.opensuse.org/package/live_build_log/OBS:Server:Unstable/obs-server/15.5/x86_64' @slack.notify(message: slack_message) if status == :failed end diff --git a/lib/slack.rb b/lib/slack.rb index cd54e10..e03267a 100644 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -4,6 +4,8 @@ class Slack SLACK_URL = ENV.fetch('OBS_TOOLS_SLACK_URL') def notify(message:) + return unless ENV.fetch('KURREN_NOTIFY_SLACK_OBS', 'false') == 'true' + response = Faraday.post(SLACK_URL) do |request| request.headers['Content-Type'] = 'application/json' request.body = { text: message }.to_json diff --git a/lib/trello.rb b/lib/trello.rb index bef535c..35c28ad 100755 --- a/lib/trello.rb +++ b/lib/trello.rb @@ -11,6 +11,8 @@ class Trello attr_accessor :status def notify + return unless ENV.fetch('KURREN_NOTIFY_TRELLO_OBS', 'false') == 'true' + change_card_content change_card_cover end