is_it_done_yet 0.1.0 → 0.2.0
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/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +12 -0
- data/is_it_done_yet.gemspec +6 -9
- data/lib/is_it_done_yet/version.rb +1 -1
- data/lib/is_it_done_yet.rb +5 -5
- metadata +8 -9
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1778acaba096d60e74ad95e7fae02e11a0a8cec0
|
4
|
+
data.tar.gz: 1fa88b4da2deae3f11f31765d86c7478ef2a6108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a14bcf35ad70e435d7a817a7a6f8f05b2292f82f5fc385135ac69778a0509940175222f9880f1fc403541b077bd13757edca2db19ae94860726e31dd71b58bb
|
7
|
+
data.tar.gz: 1ef23febcd56156d6c72ec677f661da926102d6e9043e9f1ae3912ef53ce1a19deeb16b98af72648530e0954706a273f76efedd064b89e62356032e468793274
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
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.
|
data/is_it_done_yet.gemspec
CHANGED
@@ -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
|
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'] =
|
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']
|
data/lib/is_it_done_yet.rb
CHANGED
@@ -20,7 +20,7 @@ module IsItDoneYet
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def key(build_id, node_id)
|
23
|
-
|
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(
|
44
|
+
def retrieve_all(build_id)
|
45
45
|
settings.state
|
46
46
|
.each_pair
|
47
|
-
.select { |(
|
48
|
-
.map { |(
|
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
|
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.
|
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-
|
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:
|
168
|
-
|
169
|
-
ascertaining the status of the other nodes
|
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
|
-
-
|
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
|
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
|