-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the plugins
command to Jarvis
#76
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "clamp" | ||
require "jarvis/cla" | ||
require "jarvis/patches/i18n" | ||
require "jarvis/github/review_search" | ||
require "jarvis/travis/watchdog" | ||
|
||
module Jarvis module Command class Plugins < Clamp::Command | ||
banner "Get travis status for the default plugins" | ||
|
||
def execute | ||
total_failures, total_plugins, failures = ::Jarvis::Travis::Watchdog.execute | ||
|
||
if total_failures == 0 | ||
puts "Good job, all default plugins are green! :green_heart:" | ||
else | ||
messages = [ "Oops, We have currently have *#{total_failures}* plugins jobs failing :sadbazpanda: (#{total_plugins} plugins checked)" ] | ||
messages.concat(::Jarvis::Travis::Watchdog.format_items(failures)) | ||
messages.each { |message| puts message } | ||
end | ||
end | ||
end end end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require "open-uri" | ||
require "travis" | ||
require "yaml" | ||
|
||
module Jarvis module Travis | ||
class Watchdog | ||
DEFAULT_PLUGINS_URL = "https://raw.githubusercontent.com/elastic/logstash/master/rakelib/plugins-metadata.json" | ||
PLUGINS_CONFIG_FILE = File.join(File.dirname(__FILE__), "../../../plugins_config.yml") | ||
PLUGINS_CONFIG = YAML.load(File.read(PLUGINS_CONFIG_FILE)) | ||
DEFAULT_BRANCHES = ["master"] | ||
|
||
def initialize | ||
end | ||
|
||
def default_plugins | ||
@default_plugins ||= fetch(DEFAULT_PLUGINS_URL).select { |_, v| v["default-plugins"] }.keys | ||
end | ||
|
||
def get_status | ||
status = {} | ||
|
||
default_plugins.each do |plugin_name| | ||
location = "logstash-plugins/#{plugin_name}" | ||
repo = ::Travis::Repository.find(location) | ||
branches = branch_to_monitor(plugin_name) | ||
status[plugin_name] = branches.each_with_object({}) { |branch, hsh| hsh[branch] = repo.branches[branch].passed? } | ||
end | ||
|
||
status | ||
end | ||
|
||
def extract_failures(plugins_status) | ||
failures = {} | ||
|
||
plugins_status.each do |plugin_name, status| | ||
status.each do |branch, state| | ||
if !state | ||
failures[branch] ||= [] | ||
failures[branch] << plugin_name | ||
end | ||
end | ||
end | ||
|
||
total_failures = failures.values.collect(&:size).reduce(&:+) | ||
[total_failures, plugins_status.size, failures] | ||
end | ||
|
||
def execute | ||
plugins_status = get_status | ||
extract_failures(plugins_status) | ||
end | ||
|
||
def branch_to_monitor(plugin_name) | ||
DEFAULT_BRANCHES.dup.concat(Array(PLUGINS_CONFIG["plugin_name"])).uniq | ||
end | ||
|
||
def fetch(url) | ||
MultiJson.load(open(url) { |f| f.read }) | ||
end | ||
|
||
def self.execute | ||
self.new.execute | ||
end | ||
|
||
def self.format_items(failures) | ||
messages = [] | ||
|
||
failures.each do |branch, plugins| | ||
messages << "Failures for branch: *#{branch}*" | ||
messages << plugins.sort.join(", ") | ||
end | ||
|
||
messages | ||
end | ||
end | ||
end end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
logstash-output-elasticsearch: | ||
- "6.x" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use
passed?
at the build level it will ignore jobs marked as allowed to fails (like for the feature/9000), But you can check status per job.