codeclimate 0.14.6 → 0.14.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b77427581b32cd6729aa4d13a1770b644960597c
4
- data.tar.gz: 7bdb62420b891564207ec621ae7bc51ffc5ccbf6
3
+ metadata.gz: 8680877759cb9d64b775677c48ef5ec45abdf3ac
4
+ data.tar.gz: 9857356e8ec12071e973337f505b98964321d585
5
5
  SHA512:
6
- metadata.gz: 786921be51e12ea7af81d38d0e98662e3ff80297babf1a92b303eb64d33db5c4c526908cb8880927736373db15e284059f303ee8f1b775e82fba76858e53c6c5
7
- data.tar.gz: e06d71da3ccd7e9070c6519f10717f6edc1f4b0fa68beee855254a4d317c0a3c59f76f8c3354d2844736a8b1441f22692573b7bf6126373707ec05164bc9040c
6
+ metadata.gz: 15e9c529f7fd7d656d93cc7580564ad5fb36016868292e773c260b6e53eb06a704998c867c5cc8cc378a7e5e3abaee86379aa0e729b93bbef78cb41bead356aa
7
+ data.tar.gz: 636f04b117fbd5b3951fa2409bb80fc75c99b70fbac75836c55ed79856236fec7ed976a59214b537287edca3ba56d311168060a1eef1861bddf11fc3dd826d9c
data/bin/prep-release CHANGED
@@ -34,12 +34,15 @@ git commit -m "Release v$version"
34
34
  git push origin $branch
35
35
 
36
36
  compare_link="https://github.com/codeclimate/codeclimate/compare/${old_version}...$(git rev-parse --short $branch)"
37
+ pr_description_file=$(mktemp -t cc_commit_message) || exit 1
38
+ printf "Release v$version\n\n$s\n" "$compare_link" > "$pr_description_file"
37
39
  if command -v hub > /dev/null 2>&1; then
38
- hub pull-request -m "Release v$version\n\n$compare_link"
40
+ hub pull-request -F "$pr_description_file"
39
41
  elif command -v gh > /dev/null 2>&1; then
40
- gh pull-request -m "Release v$version\n\n$compare_link"
42
+ gh pull-request -F "$pr_description_file"
41
43
  else
42
44
  echo "hub not installed? Please open the PR manually" >&2
43
45
  fi
46
+ rm "$commit_message_file"
44
47
 
45
48
  echo "After merging the version-bump PR, run bin/release"
@@ -50,17 +50,24 @@ module CC
50
50
 
51
51
  pid, _, out, err = POSIX::Spawn.popen4(*docker_run_command(options))
52
52
 
53
- t_out = read_stdout(out)
54
- t_err = read_stderr(err)
53
+ @t_out = read_stdout(out)
54
+ @t_err = read_stderr(err)
55
55
  t_timeout = timeout_thread
56
56
 
57
+ # blocks until the engine stops. there may still be stdout in flight if
58
+ # it was being produced more quickly than consumed.
57
59
  _, status = Process.waitpid2(pid)
58
60
 
61
+ # blocks until all readers are done. they're still governed by the
62
+ # timeout thread at this point. if we hit the timeout while processing
63
+ # output, the threads will be Thread#killed as part of #stop and this
64
+ # will unblock with the correct value in @timed_out
65
+ [@t_out, @t_err].each(&:join)
66
+
59
67
  if @timed_out
60
68
  duration = timeout * 1000
61
69
  @listener.timed_out(container_data(duration: duration))
62
70
  else
63
- [t_out, t_err].each(&:join)
64
71
  duration = ((Time.now - started) * 1000).round
65
72
  @listener.finished(container_data(duration: duration, status: status))
66
73
  end
@@ -74,14 +81,13 @@ module CC
74
81
  @stderr_io.string,
75
82
  )
76
83
  ensure
77
- [t_timeout, t_out, t_err].each { |t| t.kill if t }
84
+ kill_reader_threads
85
+ t_timeout.kill if t_timeout
78
86
  end
79
87
 
80
- def stop
81
- # Prevents the processing of more output after first error
82
- @on_output = ->(*) {}
83
-
84
- reap_running_container
88
+ def stop(message = nil)
89
+ reap_running_container(message)
90
+ kill_reader_threads
85
91
  end
86
92
 
87
93
  private
@@ -139,7 +145,7 @@ module CC
139
145
  end
140
146
 
141
147
  @timed_out = true
142
- reap_running_container
148
+ stop("timed out")
143
149
  end.run
144
150
  end
145
151
 
@@ -150,7 +156,7 @@ module CC
150
156
 
151
157
  if output_byte_count > maximum_output_bytes
152
158
  @maximum_output_exceeded = true
153
- stop
159
+ stop("maximum output exceeded")
154
160
  end
155
161
  end
156
162
 
@@ -158,8 +164,13 @@ module CC
158
164
  ContainerData.new(@image, @name, duration, status, @stderr_io.string)
159
165
  end
160
166
 
161
- def reap_running_container
162
- Analyzer.logger.warn("killing container name=#{@name}")
167
+ def kill_reader_threads
168
+ @t_out.kill if @t_out
169
+ @t_err.kill if @t_err
170
+ end
171
+
172
+ def reap_running_container(message)
173
+ Analyzer.logger.warn("killing container name=#{@name} message=#{message.inspect}")
163
174
  POSIX::Spawn::Child.new("docker", "kill", @name)
164
175
  end
165
176
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport