summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-04-12 12:23:51 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-04-12 12:23:51 +0000
commit9e99436d1d8f496380b86a8e9829805d0ece5250 (patch)
treeb4e3c413944f5944c414ca2a73265ec2b96b1227 /lib/gitlab
parentebb358e922c8a464429b82f6622e458891abac66 (diff)
parent23fbbe0c921ab3c878164d49316c4ce82b2035fb (diff)
downloadgitlab-ce-9e99436d1d8f496380b86a8e9829805d0ece5250.tar.gz
Merge branch 'zj-fix-coverage-bug' into 'master'
Return nil as coverage instead of a File object See merge request !10633
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/ci/trace/stream.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb
index 2af94e2c60e..41dcf846fed 100644
--- a/lib/gitlab/ci/trace/stream.rb
+++ b/lib/gitlab/ci/trace/stream.rb
@@ -76,11 +76,14 @@ module Gitlab
stream.each_line do |line|
matches = line.scan(regex)
next unless matches.is_a?(Array)
+ next if matches.empty?
match = matches.flatten.last
coverage = match.gsub(/\d+(\.\d+)?/).first
- return coverage.to_f if coverage.present?
+ return coverage if coverage.present?
end
+
+ nil
rescue
# if bad regex or something goes wrong we dont want to interrupt transition
# so we just silentrly ignore error for now