build-buddy 1.8.4 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/build_buddy.rb +1 -1
- data/lib/build_buddy/builder.rb +1 -1
- data/lib/build_buddy/config.rb +2 -0
- data/lib/build_buddy/recorder.rb +3 -2
- data/lib/build_buddy/scheduler.rb +8 -6
- data/lib/build_buddy/server.rb +1 -1
- data/lib/build_buddy/slacker.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76cc3ddfbee154ee1432443968a760f9e17e79e8
|
4
|
+
data.tar.gz: 575d15f41abb55fcbc7e0e8174144f3926e5c568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc093742b96214e7f4f5a2e1c58bb1fe39efe77fadacec41d75a86672da153d6098bc90b48dbc11c7571bb83c490fad7b19a7cba2dc04e536c110a72763c88c2
|
7
|
+
data.tar.gz: 456bcf537cd820466616367118a23fdef23c67c08842c9d6ead7ed35cf3ed86fa38809f303be637ab81f67dd91b423d4ba89a295ae1e247cd034cd9a3841dfc4
|
data/lib/build_buddy.rb
CHANGED
data/lib/build_buddy/builder.rb
CHANGED
@@ -81,7 +81,7 @@ module BuildBuddy
|
|
81
81
|
begin
|
82
82
|
metrics = Psych.load_stream(File.read(@metrics_tempfile.path)).reduce({}, :merge)
|
83
83
|
rescue Psych::SyntaxError => ex
|
84
|
-
error "There was a problem collecting
|
84
|
+
error "There was a problem collecting build metrics: #{ex.message}"
|
85
85
|
end
|
86
86
|
if !metrics
|
87
87
|
metrics = {}
|
data/lib/build_buddy/config.rb
CHANGED
@@ -19,12 +19,14 @@ module BuildBuddy
|
|
19
19
|
attr_accessor :valid_release_versions
|
20
20
|
attr_accessor :kill_build_after_mins
|
21
21
|
attr_accessor :server_base_uri
|
22
|
+
attr_accessor :mongo_uri
|
22
23
|
end
|
23
24
|
|
24
25
|
class << self
|
25
26
|
def configure
|
26
27
|
Config.github_webhook_port = 4567
|
27
28
|
Config.kill_build_after_mins = 30
|
29
|
+
Config.mongo_uri = 'mongodb://localhost:27017/build-buddy'
|
28
30
|
block_given? ? yield(Config) : Config
|
29
31
|
end
|
30
32
|
|
data/lib/build_buddy/recorder.rb
CHANGED
@@ -11,8 +11,9 @@ module BuildBuddy
|
|
11
11
|
|
12
12
|
def initialize()
|
13
13
|
Mongo::Logger.logger.level = ::Logger::FATAL
|
14
|
-
|
15
|
-
|
14
|
+
mongo_uri = BuildBuddy::Config.mongo_uri
|
15
|
+
@mongo ||= Mongo::Client.new(mongo_uri)
|
16
|
+
info "Connected to MongoDB at '#{mongo_uri}'"
|
16
17
|
@mongo[:builds].indexes.create_one({:start_time => -1}, :name => "reverse_build_order")
|
17
18
|
end
|
18
19
|
|
@@ -53,7 +53,12 @@ module BuildBuddy
|
|
53
53
|
|
54
54
|
def on_build_interval
|
55
55
|
if @active_build.nil?
|
56
|
-
|
56
|
+
# No active build so...
|
57
|
+
if @done_queue.length > 0 # First, send any completed build statuses
|
58
|
+
build_data = @done_queue.pop
|
59
|
+
Celluloid::Actor[:slacker].async.notify_channel(build_data)
|
60
|
+
Celluloid::Actor[:recorder].async.update_build_data(build_data)
|
61
|
+
elsif @build_queue.length > 0 # Then, check if there are any builds waiting to go
|
57
62
|
build_data = @build_queue.pop()
|
58
63
|
@active_build = build_data
|
59
64
|
Celluloid::Actor[:recorder].async.record_build_data(build_data)
|
@@ -62,14 +67,11 @@ module BuildBuddy
|
|
62
67
|
build_data.repo_full_name, build_data.repo_sha, :pending, "This build has started")
|
63
68
|
end
|
64
69
|
Celluloid::Actor[:builder].async.start_build(build_data)
|
65
|
-
|
66
|
-
build_data = @done_queue.pop
|
67
|
-
Celluloid::Actor[:slacker].async.notify_channel(build_data)
|
68
|
-
Celluloid::Actor[:recorder].async.update_build_data(build_data)
|
69
|
-
else
|
70
|
+
else # Otherwise, stop the timer until we get a build queued.
|
70
71
|
@build_timer.cancel
|
71
72
|
@build_timer = nil
|
72
73
|
info "Build timer stopped"
|
74
|
+
# Now we won't get any more build intervals
|
73
75
|
end
|
74
76
|
else
|
75
77
|
# Make sure that the build has not run too long and kill if necessary
|
data/lib/build_buddy/server.rb
CHANGED
@@ -11,7 +11,7 @@ module BuildBuddy
|
|
11
11
|
|
12
12
|
def initialize()
|
13
13
|
super("127.0.0.1", Config.github_webhook_port, &method(:on_connection))
|
14
|
-
info "
|
14
|
+
info "Web server listening on port #{Config.github_webhook_port}"
|
15
15
|
end
|
16
16
|
|
17
17
|
def on_connection(connection)
|
data/lib/build_buddy/slacker.rb
CHANGED
@@ -286,13 +286,20 @@ Ask me `what happened` to get a list of recent builds and log files and `what op
|
|
286
286
|
info "Release branch build #{status_message}"
|
287
287
|
end
|
288
288
|
|
289
|
+
# See https://api.slack.com/docs/attachments for more information about formatting Slack attachments
|
290
|
+
attach = [
|
291
|
+
:title => build_data.type == :pull_request ? "Pull Request" : "Branch Build",
|
292
|
+
:text => message,
|
293
|
+
:color => build_data.termination_type == :killed ? :warning : build_data.exit_code != 0 ? :danger : :good,
|
294
|
+
]
|
295
|
+
|
289
296
|
if build_data.flags.include?(:test_channel)
|
290
297
|
unless @test_slack_channel.nil?
|
291
|
-
@rt_client.message(channel: @test_slack_channel, text: message)
|
298
|
+
@rt_client.message(channel: @test_slack_channel, text: message, attachments: attach)
|
292
299
|
end
|
293
300
|
else
|
294
301
|
unless @build_slack_channel.nil?
|
295
|
-
@rt_client.message(channel: @build_slack_channel, text: message)
|
302
|
+
@rt_client.message(channel: @build_slack_channel, text: message, attachments: attach)
|
296
303
|
end
|
297
304
|
end
|
298
305
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-buddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Lyon-smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timers
|