travis_parallel_sentinel 0.1.10 → 0.1.11
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/Gemfile.lock +1 -1
- data/lib/travis_parallel_sentinel/version.rb +1 -1
- data/lib/travis_parallel_sentinel.rb +13 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fcedec353e96923f6d1a2a50708f6f6a439368c
|
4
|
+
data.tar.gz: 599ccf2d32cda9d9c045bcfe105a620b70563dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e492d0607c92d0b5fc82c9bcccff061a116df96417036aaab256d8419cd83a5810c1e2b0975868601aaa9e3a1b8dcec870b90bbe7d4c84c0f12e803e63c134a
|
7
|
+
data.tar.gz: b8f13a575f6bee4dcaa4cfb32cc7638546b13476ad3c5228a9bd54e6802488e502da7f01ddbd105cca1d4963faa76d4ad454e57008e79b79ee84d4c2c81560f7
|
data/Gemfile.lock
CHANGED
@@ -9,16 +9,6 @@ TRAVIS_BUILD_ID = ENV['TRAVIS_BUILD_ID'].to_s.strip
|
|
9
9
|
$stdout.sync = $stderr.sync = true
|
10
10
|
|
11
11
|
module TravisParallelSentinel
|
12
|
-
def result(job)
|
13
|
-
prefix = "#{job.number}="
|
14
|
-
return prefix + 'running' if job.result.nil?
|
15
|
-
return prefix + 'ok' if job.result == 0
|
16
|
-
return prefix + 'failed'
|
17
|
-
end
|
18
|
-
def results(jobs)
|
19
|
-
return jobs.collect{|job| result(job)}.join(', ')
|
20
|
-
end
|
21
|
-
|
22
12
|
def status(phase)
|
23
13
|
raise "Unexpected phase #{phase.inspect}, expected 'script' or 'after'" unless %w{script after}.include?(phase.to_s.downcase)
|
24
14
|
phase = phase.to_s.downcase.to_sym
|
@@ -26,14 +16,25 @@ module TravisParallelSentinel
|
|
26
16
|
return :deploy if TRAVIS_JOB_NUMBER == '' # no build matrix, so good to go
|
27
17
|
return :ignore unless TRAVIS_JOB_NUMBER =~ /\.1$/ # first job in the sequence is the deployment container
|
28
18
|
|
19
|
+
results = lambda do |job|
|
20
|
+
prefix = "#{job.number}="
|
21
|
+
return prefix + 'running' if job.result.nil?
|
22
|
+
return prefix + 'ok' if job.result == 0
|
23
|
+
return prefix + 'failed'
|
24
|
+
end
|
25
|
+
|
26
|
+
results = lambda do |jobs|
|
27
|
+
return jobs.collect{|job| result.call(job)}.join(', ')
|
28
|
+
end
|
29
|
+
|
29
30
|
while true
|
30
31
|
builds = JSON.parse(open("https://api.travis-ci.org/builds/#{TRAVIS_BUILD_ID}").read)
|
31
32
|
jobs = builds['matrix'].collect{|job| OpenStruct.new(job)}
|
32
33
|
if jobs.select{|job| job.number != TRAVIS_JOB_NUMBER || phase == :after}.detect{|job| job.result.nil?}
|
33
|
-
$stderr.puts "waiting... #{results(jobs)}"
|
34
|
+
$stderr.puts "waiting... #{results.call(jobs)}"
|
34
35
|
sleep 5
|
35
36
|
elsif jobs.detect{|job| job.result != 0}
|
36
|
-
throw "Some jobs failed: #{results(jobs)}"
|
37
|
+
throw "Some jobs failed: #{results.call(jobs)}"
|
37
38
|
else
|
38
39
|
return :deploy
|
39
40
|
end
|