build-buddy 1.1.1 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9edf5fca3601b95a498801898c367879d99453df
4
- data.tar.gz: 9abc45a421265ef5b57123d9e0a77bab0e795c4c
3
+ metadata.gz: 20b7313e36172e051a99a9b341a94fc92338455a
4
+ data.tar.gz: 578b2c07c30fc4d4cf678049ae2e9212883e1857
5
5
  SHA512:
6
- metadata.gz: dc2c8482c86124374f51dca9ac2092879f2c972f993c61ac6fdaf59c32dd090c8448708461ee3364883fc47a6f1e1ecb5362a4ba01757e38c567fc861d5af4a2
7
- data.tar.gz: 4f9374716fb92234bba3a8ded46f555b7ebd15749a1b8aca437831742af30d4e001aba809ddaf1bc6766feb2fac93b2886b655e9e72b9621e966f3301fab2f39
6
+ metadata.gz: 144e5b4600e573917693fd6389c8d7e9e7f9ea1d53a27f65806779014cbdbe6748c2add4ded28a36f619830348bd43e4a552f902a8322bf5c71920d3006e9ad3
7
+ data.tar.gz: c96c2800fa8975b29e3511c23dc108c78f316f103d61f6245b0d33d36098daaeacc8a9dfebcf85f3ad217930f5e4b0b6c520f55d6952a6fcd8949d32f9d0e212
data/lib/build_buddy.rb CHANGED
@@ -4,6 +4,6 @@ require 'build_buddy/builder'
4
4
  require 'build_buddy/watcher'
5
5
 
6
6
  module BuildBuddy
7
- VERSION = "1.1.1"
7
+ VERSION = "1.2.0"
8
8
  end
9
9
 
@@ -15,6 +15,7 @@ module BuildBuddy
15
15
 
16
16
  def initialize
17
17
  @pid = nil
18
+ @gid = nil
18
19
  @watcher = nil
19
20
  end
20
21
 
@@ -27,7 +28,9 @@ module BuildBuddy
27
28
  "GIT_REPO_NAME" => repo_parts[1],
28
29
  "RBENV_DIR" => nil,
29
30
  "RBENV_VERSION" => nil,
30
- "PATH" => ENV['PATH'].split(':').select { |v| !v.match(/\.rbenv\/versions/) }.join(':')
31
+ "RBENV_HOOK_PATH" => nil,
32
+ "RBENV_ROOT" => nil,
33
+ "PATH" => ENV['PATH'].split(':').select { |v| !v.match(/\.rbenv\/versions|Cellar\/rbenv/) }.join(':')
31
34
  }
32
35
 
33
36
  case build_data.build_type
@@ -43,15 +46,14 @@ module BuildBuddy
43
46
  raise "Unknown build type"
44
47
  end
45
48
 
46
- build_log_filename = File.join(Config.build_log_dir, "build_#{build_data.build_type.to_s}_#{Time.now.utc.strftime('%Y%m%d%H%M%S')}.log")
49
+ build_log_filename = File.join(Config.build_log_dir, "build_#{build_data.build_type.to_s}_#{Time.now.utc.strftime('%Y%m%d%_H%M%S')}.log")
47
50
  build_data.build_log_filename = build_log_filename
48
51
 
49
- command += " >#{build_log_filename} 2>&1"
50
-
51
52
  Bundler.with_clean_env do
52
- @pid = Process.spawn(env, command)
53
+ @pid = Process.spawn(env, command, :pgroup => true, [:out, :err] => build_log_filename)
54
+ @gid = Process.getpgid(@pid)
53
55
  end
54
- info "Running '#{command}' (process #{@pid})"
56
+ info "Running #{File.basename(command)} (pid #{@pid}, gid #{@gid}) : Log #{build_log_filename}"
55
57
 
56
58
  if @watcher
57
59
  @watcher.terminate
@@ -71,9 +73,9 @@ module BuildBuddy
71
73
  end
72
74
 
73
75
  def stop_build
74
- if @pid
75
- info "Killing pid #{@pid}"
76
- Process.kill(:SIGABRT, @pid)
76
+ if @gid
77
+ info "Killing gid #{@gid}"
78
+ Process.kill(:SIGABRT, -@gid)
77
79
  end
78
80
  end
79
81
  end
@@ -126,7 +126,7 @@ module BuildBuddy
126
126
  Celluloid::Actor[:builder].async.stop_build
127
127
  end
128
128
  else
129
- response = "Sorry#{in_channel ? " <@#{data['user']}>" : ""}, I'm not sure if you want do an internal *master*, external *M.m* build, or maybe *stop* any running build?"
129
+ response = "Sorry#{in_channel ? " <@#{data['user']}>" : ""}, I'm not sure if you want do a *master*, or *M.m* branch build, or maybe *stop* any running build?"
130
130
  end
131
131
  end
132
132
  when /status/i
@@ -219,9 +219,9 @@ module BuildBuddy
219
219
  { :description => "This build is in the queue" })
220
220
  info "Pull request build queued"
221
221
  when :master
222
- info "Internal build queued"
222
+ info "`master` branch build queued"
223
223
  when :release
224
- info "External build queued"
224
+ info "Release branch build queued"
225
225
  end
226
226
 
227
227
  if @build_timer.nil?
@@ -258,16 +258,16 @@ module BuildBuddy
258
258
  @gh_client.create_status(
259
259
  build_data.repo_full_name, build_data.repo_sha,
260
260
  build_data.termination_type == :killed ? 'failure' : build_data.exit_code != 0 ? 'error' : 'success',
261
- { :description => description })
261
+ { :description => description.length > 140 ? "#{description[0..137]}..." : description })
262
262
  info "Pull request build #{term_msg}"
263
263
  else
264
264
  case build_data.build_type
265
265
  when :master
266
266
  message = "A build of the `master` branch #{term_msg}."
267
- info "Internal build #{term_msg}"
267
+ info "`master` branch build #{term_msg}"
268
268
  when :release
269
269
  message = "A build of the `#{build_data.build_version}` branch #{term_msg}."
270
- info "External build #{term_msg}"
270
+ info "Release branch build #{term_msg}"
271
271
  end
272
272
  unless @notify_slack_channel.nil?
273
273
  @rt_client.message(channel: @notify_slack_channel, text: message)
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.1.1
4
+ version: 1.2.0
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-01-27 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: timers