is_it_done_yet 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cded42ede28e4279d6d57be770449cb57cd4370
4
- data.tar.gz: bdffab5e1c71d5781a93096d58f4ea10d0284588
3
+ metadata.gz: 1778acaba096d60e74ad95e7fae02e11a0a8cec0
4
+ data.tar.gz: 1fa88b4da2deae3f11f31765d86c7478ef2a6108
5
5
  SHA512:
6
- metadata.gz: e92becf7e492523175a4bfc243b0ed44afe464a9143a425d8ccec1c69680e8f22fdd52c06229401f5dd910d99e9331061f303fad5467cf4a7ff84acb46ff5243
7
- data.tar.gz: bd8ffb0dfbd1c7b0cc517c48fa90add9942a6f673680d488b4b683fd8eac38e87a911107f895b740cf0d99b1267450be302f5a4987d5b13c5facd8b0e0b95031
6
+ metadata.gz: 0a14bcf35ad70e435d7a817a7a6f8f05b2292f82f5fc385135ac69778a0509940175222f9880f1fc403541b077bd13757edca2db19ae94860726e31dd71b58bb
7
+ data.tar.gz: 1ef23febcd56156d6c72ec677f661da926102d6e9043e9f1ae3912ef53ce1a19deeb16b98af72648530e0954706a273f76efedd064b89e62356032e468793274
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ *.gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # 0.2.0
2
+
3
+ Features:
4
+
5
+ * Build ids and node ids may now contain any (url-escaped) character.
6
+ - Note that when all nodes of a build are queried, `GET /builds/:build_id`, node ids will appear in their url-unescaped form.
data/README.md CHANGED
@@ -6,6 +6,8 @@ The intended use case is when you want to use one of the build nodes as a master
6
6
 
7
7
  Specifically I built it to allow a travis job at work to do parallel tests with Knapsack and do a deploy if all tests pass.
8
8
 
9
+ An example Travis build configuration that takes advantage of a deployed `is_it_done_yet` service is available in [examples](exampels/.travis.yml).
10
+
9
11
  ## Installation
10
12
 
11
13
  Add this line to your application's Gemfile:
@@ -26,6 +28,16 @@ Or install it yourself as:
26
28
 
27
29
  This library includes a Rack application which you can instantiate by doing `IsItDoneYet.build_app`. In the [example Rack config](examples/config.ru) there's a setup with token-based auth middleware. Include a similar `config.ru` at the root of your application and run `bundle exec rackup` to start the web app locally. If you're running it on a cloud service, follow your service's guidelines on deploying Rack applications.
28
30
 
31
+ The web app provides three endpoints:
32
+ * `POST /builds/:build_id/nodes/:node_id`
33
+ - example request body: `{ "build_state" : "ok" }`
34
+ * `GET /builds/:build_id`
35
+ - example response body: `{ "build_states": { "51": "bad", "52": "ok" } }`
36
+ * `GET /builds/:build_id/nodes/:node_id`
37
+ - example response body: `{ "build_state": "ok" }`
38
+
39
+ The app keeps the build states in memory. This means that values will be lost after a restart of the service. Further, load balancing across multiple instances will only work if routing to the individual instance is consistent for the same `:build_id` path parameter, but scaling beyond one app instance is not currently a known use case.
40
+
29
41
  ## Development
30
42
 
31
43
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -9,20 +9,16 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Erik Madsen']
10
10
  spec.email = ['beatmadsen@gmail.com']
11
11
 
12
- spec.summary = 'Tracks status of Travis matrix build nodes'
13
- spec.description = '
14
- In case you need to carry out build steps
15
- in one of the nodes after the other nodes finish, e.g. deploying,
16
- then you need a way of ascertaining the status of the other nodes.
17
- This is what is_it_done_yet is for.
18
- '
12
+ spec.summary = 'Tracks statuses of CI build nodes'
13
+ spec.description = 'In case you need to carry out build steps in one of the nodes of your CI project after the other nodes finish, e.g. deploying, then you need a way of ascertaining the status of the other nodes. This is what is_it_done_yet is for.'
19
14
  spec.homepage = 'http://www.github.com/beatmadsen/is_it_done_yet'
20
15
  spec.license = 'MIT'
16
+ spec.required_ruby_version = '>= 2.0'
21
17
 
22
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
23
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
24
20
  if spec.respond_to?(:metadata)
25
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
26
22
  else
27
23
  raise 'RubyGems 2.0 or newer is required to protect against ' \
28
24
  'public gem pushes.'
@@ -30,7 +26,8 @@ Gem::Specification.new do |spec|
30
26
 
31
27
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
32
28
  f.match(%r{^(test|spec|features)/}) ||
33
- f.match(/knapsack/)
29
+ f.match(/knapsack/) ||
30
+ f.match(/travis/)
34
31
  end
35
32
  spec.bindir = 'bin'
36
33
  spec.require_paths = ['lib']
@@ -1,3 +1,3 @@
1
1
  module IsItDoneYet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -20,7 +20,7 @@ module IsItDoneYet
20
20
  private
21
21
 
22
22
  def key(build_id, node_id)
23
- "#{build_id}|#{node_id}"
23
+ [build_id, node_id].freeze
24
24
  end
25
25
 
26
26
  def house_keeping
@@ -41,11 +41,11 @@ module IsItDoneYet
41
41
  build_state
42
42
  end
43
43
 
44
- def retrieve_all(prefix)
44
+ def retrieve_all(build_id)
45
45
  settings.state
46
46
  .each_pair
47
- .select { |(key, _v)| key.start_with?(prefix) }
48
- .map { |(key, (build_state, _t))| [key.split('|')[1], build_state] }
47
+ .select { |((b, _n), _v)| build_id == b }
48
+ .map { |((_b, node_id), (build_state, _t))| [node_id, build_state] }
49
49
  .to_h
50
50
  end
51
51
  end
@@ -73,7 +73,7 @@ module IsItDoneYet
73
73
 
74
74
  build_states = retrieve_all(build_id)
75
75
 
76
- halt 404, UNKNOWN_BUILD unless build_states
76
+ halt 404, UNKNOWN_BUILD if build_states.to_a.empty?
77
77
 
78
78
  content_type :json
79
79
  { build_states: build_states }.to_json
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_it_done_yet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Madsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -164,10 +164,9 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.13'
167
- description: "\n In case you need to carry out build steps\n in one of the
168
- nodes after the other nodes finish, e.g. deploying,\n then you need a way of
169
- ascertaining the status of the other nodes.\n This is what is_it_done_yet is
170
- for.\n "
167
+ description: In case you need to carry out build steps in one of the nodes of your
168
+ CI project after the other nodes finish, e.g. deploying, then you need a way of
169
+ ascertaining the status of the other nodes. This is what is_it_done_yet is for.
171
170
  email:
172
171
  - beatmadsen@gmail.com
173
172
  executables: []
@@ -176,7 +175,7 @@ extra_rdoc_files: []
176
175
  files:
177
176
  - ".gitignore"
178
177
  - ".rspec"
179
- - ".travis.yml"
178
+ - CHANGELOG.md
180
179
  - CODE_OF_CONDUCT.md
181
180
  - Gemfile
182
181
  - LICENSE.txt
@@ -204,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
203
  requirements:
205
204
  - - ">="
206
205
  - !ruby/object:Gem::Version
207
- version: '0'
206
+ version: '2.0'
208
207
  required_rubygems_version: !ruby/object:Gem::Requirement
209
208
  requirements:
210
209
  - - ">="
@@ -215,5 +214,5 @@ rubyforge_project:
215
214
  rubygems_version: 2.6.11
216
215
  signing_key:
217
216
  specification_version: 4
218
- summary: Tracks status of Travis matrix build nodes
217
+ summary: Tracks statuses of CI build nodes
219
218
  test_files: []
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.4.1
6
- before_install: gem install bundler -v 1.14.6
7
- bundler_args: --without production
8
-
9
- env:
10
- global:
11
- - MY_GLOBAL_VAR=123
12
- - CI_NODE_TOTAL=2
13
- matrix:
14
- - CI_NODE_INDEX=0
15
- - CI_NODE_INDEX=1
16
-
17
- script: bundle exec rake knapsack:rspec && examples/ci-sync && examples/ci-deploy
18
-
19
- after_success: examples/ci-post OK
20
- after_failure: examples/ci-post FAILED