buildbox 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/buildbox/agent.rb +15 -9
- data/lib/buildbox/server.rb +3 -3
- data/lib/buildbox/version.rb +1 -1
- 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: 2342efcf6dbbfc591fbabea8d86e81f261fb06b6
|
4
|
+
data.tar.gz: 316d7a8726e2376bbeb0a54eb615d66c5bc18294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6ccad33be924b0c2893cff55fa5f33e7ce3d766a15baac6ec57f27cd81f6dc58d1e90e3b8f76a5b6cd1640a426b8abd2ec900cfa773fd2fe087c1108793fba
|
7
|
+
data.tar.gz: 4f9022099235838076447e9f19aa6e2c3ea448905444e7ce272e48ff4204f149fd98edde99addcce6b0c65abd828f530c0f6aeb2b31827af469400f8de40f4f9
|
data/Gemfile.lock
CHANGED
data/lib/buildbox/agent.rb
CHANGED
@@ -8,18 +8,24 @@ module Buildbox
|
|
8
8
|
def initialize(access_token, api = Buildbox::API.new)
|
9
9
|
@api = api
|
10
10
|
@access_token = access_token
|
11
|
+
@queue = []
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
-
|
14
|
+
def process
|
15
|
+
unless @processing
|
16
|
+
@processing = true
|
15
17
|
|
16
|
-
|
17
|
-
builds.each do |build|
|
18
|
-
# Let the agent know that we're about to start working on this build
|
19
|
-
@api.update_build(build, :agent_accepted => @access_token)
|
18
|
+
scheduled_builds.each { |build| @queue << build }
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
while build = @queue.pop do
|
21
|
+
# Let the agent know that we're about to start running this build
|
22
|
+
@api.update_build(build, :agent_accepted => @access_token)
|
23
|
+
|
24
|
+
Monitor.new(build, @api).async.monitor
|
25
|
+
Runner.new(build).start
|
26
|
+
end
|
27
|
+
|
28
|
+
@processing = false
|
23
29
|
end
|
24
30
|
end
|
25
31
|
|
@@ -29,7 +35,7 @@ module Buildbox
|
|
29
35
|
agent = @api.agent(@access_token, hostname)
|
30
36
|
@api.scheduled_builds agent
|
31
37
|
rescue Buildbox::API::AgentNotFoundError
|
32
|
-
warn "Agent `#{@access_token}`
|
38
|
+
warn "Agent `#{@access_token}` does not exist"
|
33
39
|
[] # return empty array to avoid breakage
|
34
40
|
end
|
35
41
|
|
data/lib/buildbox/server.rb
CHANGED
@@ -5,8 +5,8 @@ module Buildbox
|
|
5
5
|
INTERVAL = 5
|
6
6
|
|
7
7
|
def initialize(config = Buildbox.config, logger = Buildbox.logger)
|
8
|
-
@config
|
9
|
-
@logger
|
8
|
+
@config = config
|
9
|
+
@logger = logger
|
10
10
|
@supervisors = []
|
11
11
|
end
|
12
12
|
|
@@ -21,7 +21,7 @@ module Buildbox
|
|
21
21
|
|
22
22
|
loop do
|
23
23
|
@supervisors.each do |supervisor|
|
24
|
-
supervisor.actors.first.async.
|
24
|
+
supervisor.actors.first.async.process
|
25
25
|
end
|
26
26
|
|
27
27
|
wait INTERVAL
|
data/lib/buildbox/version.rb
CHANGED