embulk-input-travis 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/embulk-input-travis.gemspec +1 -1
- data/lib/embulk/input/travis.rb +37 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 505e7ec4a05361418365c85e289819a047e0850641dd4b7d22e55db658afbdd7
|
4
|
+
data.tar.gz: 9a19650beb11ee32ab9ab8b60481b7578a1b8569c80fdf88a18b70f48dfa5949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63620f847cab224d667a3b681e176e1eebda8dea87a1d4816134ef710a48250d91a1e4f4ea1c8f7f65b44a33583218823c3550549c3c390d257e6b170c4464a
|
7
|
+
data.tar.gz: a4a157dfcf9a7a09b855fb6062a64c62a3c8e800d328db01ff5619eb765322dabca0c9dedcdd9d80da044078bd5de7bc9ec79408b5918f55ff841f0ae88fc5aa
|
data/CHANGELOG.md
ADDED
data/embulk-input-travis.gemspec
CHANGED
data/lib/embulk/input/travis.rb
CHANGED
@@ -67,7 +67,7 @@ module Embulk
|
|
67
67
|
|
68
68
|
repo.session.clear_cache!
|
69
69
|
|
70
|
-
build = repo.build(build_num)
|
70
|
+
build = with_retry { repo.build(build_num) }
|
71
71
|
unless build&.finished?
|
72
72
|
Embulk.logger.info { "embulk-input-travis: Skip build_num:[#{build_num}]" }
|
73
73
|
|
@@ -75,6 +75,22 @@ module Embulk
|
|
75
75
|
next
|
76
76
|
end
|
77
77
|
|
78
|
+
build.job_ids.each do |job_id|
|
79
|
+
with_retry do
|
80
|
+
job = client.session.find_one(::Travis::Client::Job, job_id)
|
81
|
+
|
82
|
+
Embulk.logger.info { "embulk-input-travis: Start job_id:[#{job.id}]" }
|
83
|
+
|
84
|
+
page_builder.add([
|
85
|
+
job.id,
|
86
|
+
job.to_h.to_json,
|
87
|
+
job.log.body,
|
88
|
+
build.number.to_i,
|
89
|
+
build.to_h.to_json
|
90
|
+
])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
78
94
|
build.jobs.each do |job|
|
79
95
|
Embulk.logger.info { "embulk-input-travis: Start job_id:[#{job.id}]" }
|
80
96
|
|
@@ -115,6 +131,26 @@ module Embulk
|
|
115
131
|
def client
|
116
132
|
@client ||= ::Travis::Client.new(access_token: task["token"])
|
117
133
|
end
|
134
|
+
|
135
|
+
MAX_RETRY = 5
|
136
|
+
|
137
|
+
def with_retry(&block)
|
138
|
+
retries = 0
|
139
|
+
begin
|
140
|
+
yield
|
141
|
+
rescue => e
|
142
|
+
sleep retries
|
143
|
+
|
144
|
+
if retries < MAX_RETRY
|
145
|
+
retries += 1
|
146
|
+
Embulk.logger.warn { "embulk-input-travis: retry ##{retries}, #{e.message}" }
|
147
|
+
retry
|
148
|
+
else
|
149
|
+
Embulk.logger.error { "embulk-input-travis: retry exhausted ##{retries}, #{e.message}" }
|
150
|
+
raise e
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
118
154
|
end
|
119
155
|
|
120
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-travis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02
|
11
|
+
date: 2019-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: travis
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".ruby-version"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- Dockerfile
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|