go_api_client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/go_api_client/atom/feed.rb +0 -57
- data/lib/go_api_client/atom.rb +0 -1
- data/lib/go_api_client/job.rb +18 -0
- data/lib/go_api_client/pipeline.rb +28 -0
- data/lib/go_api_client/stage.rb +31 -0
- data/lib/go_api_client/version.rb +1 -1
- data/lib/go_api_client.rb +6 -2
- data/test/fixtures/job_1_console.log.txt +82 -0
- data/test/fixtures/job_2_console.log.txt +82 -0
- data/test/fixtures/jobs_1.xml +29 -0
- data/test/fixtures/jobs_2.xml +29 -0
- data/test/go_api_client/integration_test.rb +9 -4
- data/test/test_helper.rb +5 -0
- metadata +15 -6
- data/lib/go_api_client/test/stub_http_fetcher.rb +0 -91
- data/lib/go_api_client/test.rb +0 -1
data/Gemfile.lock
CHANGED
@@ -20,63 +20,6 @@ module GoApiClient
|
|
20
20
|
end
|
21
21
|
self
|
22
22
|
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
class Stage
|
29
|
-
attr_reader :authors, :details_link, :name, :result
|
30
|
-
|
31
|
-
def initialize(entry, pipelines)
|
32
|
-
@authors = entry.authors
|
33
|
-
@details_link = entry.stage_href
|
34
|
-
@pipelines = pipelines
|
35
|
-
end
|
36
|
-
|
37
|
-
def fetch
|
38
|
-
doc = Nokogiri::XML(open(self.details_link))
|
39
|
-
@name = doc.root.xpath("@name").first.value
|
40
|
-
@result = doc.root.xpath("//result").first.content
|
41
|
-
|
42
|
-
pipeline_link = doc.root.xpath("//pipeline").first.attributes["href"].value
|
43
|
-
existing_pipeline = @pipelines.find {|p| p.same?(pipeline_link)}
|
44
|
-
|
45
|
-
if existing_pipeline
|
46
|
-
existing_pipeline.stages << self
|
47
|
-
else
|
48
|
-
new_pipeline = Pipeline.new(pipeline_link).fetch
|
49
|
-
new_pipeline.stages << self
|
50
|
-
@pipelines << new_pipeline
|
51
|
-
end
|
52
|
-
@pipelines
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class Pipeline
|
57
|
-
attr_reader :details_link, :id, :commit_messages
|
58
|
-
attr_accessor :stages
|
59
|
-
|
60
|
-
def initialize(details_link)
|
61
|
-
@details_link = details_link
|
62
|
-
@stages = []
|
63
|
-
end
|
64
|
-
|
65
|
-
def fetch
|
66
|
-
doc = Nokogiri::XML(open(self.details_link))
|
67
|
-
@label = doc.root.attributes["label"].value
|
68
|
-
@id = doc.root.xpath("//id").first.content
|
69
|
-
@commit_messages = doc.root.xpath("//message").map(&:content)
|
70
|
-
self
|
71
|
-
end
|
72
|
-
|
73
|
-
def authors
|
74
|
-
authors = stages.map(&:authors).flatten
|
75
|
-
authors.map(&:name).flatten.uniq.join(" ,")
|
76
|
-
end
|
77
|
-
|
78
|
-
def same?(link)
|
79
|
-
@details_link == link
|
80
23
|
end
|
81
24
|
end
|
82
25
|
end
|
data/lib/go_api_client/atom.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module GoApiClient
|
2
|
+
class Job
|
3
|
+
attr_reader :artifacts_uri, :console_log_url
|
4
|
+
|
5
|
+
def self.build(stage, links)
|
6
|
+
@stage = stage
|
7
|
+
links.collect do |link|
|
8
|
+
job = Nokogiri::XML(open(link))
|
9
|
+
self.new(job.xpath("//artifacts").first.attributes["baseUri"].value)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(artifacts_uri)
|
14
|
+
@artifacts_uri = artifacts_uri
|
15
|
+
@console_log_url = "#{artifacts_uri}/cruise-output/console.log"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GoApiClient
|
2
|
+
class Pipeline
|
3
|
+
attr_reader :details_link, :id, :commit_messages
|
4
|
+
attr_accessor :stages
|
5
|
+
|
6
|
+
def initialize(details_link)
|
7
|
+
@details_link = details_link
|
8
|
+
@stages = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
doc = Nokogiri::XML(open(self.details_link))
|
13
|
+
@label = doc.root.attributes["label"].value
|
14
|
+
@id = doc.root.xpath("//id").first.content
|
15
|
+
@commit_messages = doc.root.xpath("//message").map(&:content)
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
def authors
|
20
|
+
authors = stages.map(&:authors).flatten
|
21
|
+
authors.map(&:name).flatten.uniq.join(" ,")
|
22
|
+
end
|
23
|
+
|
24
|
+
def same?(link)
|
25
|
+
@details_link == link
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module GoApiClient
|
2
|
+
class Stage
|
3
|
+
attr_reader :authors, :details_link, :name, :result, :jobs
|
4
|
+
|
5
|
+
def initialize(entry, pipelines)
|
6
|
+
@authors = entry.authors
|
7
|
+
@details_link = entry.stage_href
|
8
|
+
@pipelines = pipelines
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch
|
12
|
+
doc = Nokogiri::XML(open(self.details_link))
|
13
|
+
@name = doc.root.xpath("@name").first.value
|
14
|
+
@result = doc.root.xpath("//result").first.content
|
15
|
+
job_detail_links = doc.root.xpath("//job").collect{|job| job.attributes["href"]}
|
16
|
+
@jobs = Job.build(self, job_detail_links)
|
17
|
+
|
18
|
+
pipeline_link = doc.root.xpath("//pipeline").first.attributes["href"].value
|
19
|
+
existing_pipeline = @pipelines.find {|p| p.same?(pipeline_link)}
|
20
|
+
|
21
|
+
if existing_pipeline
|
22
|
+
existing_pipeline.stages << self
|
23
|
+
else
|
24
|
+
new_pipeline = Pipeline.new(pipeline_link).fetch
|
25
|
+
new_pipeline.stages << self
|
26
|
+
@pipelines << new_pipeline
|
27
|
+
end
|
28
|
+
@pipelines
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/go_api_client.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
+
require "open-uri"
|
3
|
+
|
2
4
|
require "go_api_client/version"
|
3
5
|
require "go_api_client/atom"
|
4
|
-
require
|
6
|
+
require 'go_api_client/pipeline.rb'
|
7
|
+
require 'go_api_client/stage.rb'
|
8
|
+
require 'go_api_client/job.rb'
|
9
|
+
|
5
10
|
module GoApiClient
|
6
11
|
def self.runs(host)
|
7
12
|
doc = Nokogiri::XML(open("http://#{host}/go/api/pipelines/defaultPipeline/stages.xml"))
|
@@ -12,5 +17,4 @@ module GoApiClient
|
|
12
17
|
end
|
13
18
|
pipelines
|
14
19
|
end
|
15
|
-
|
16
20
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
[cruise] Start to prepare defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:06 GMT+05:30 2012
|
3
|
+
|
4
|
+
[cruise] Start updating files at revision f38508a26e1dc27737eb760e39a6aa8220f8b8c6 from git@github.com:oogabooga/zinger.git
|
5
|
+
Cloning into '/Users/saas/go-agent-12.1.0/pipelines/defaultPipeline'...
|
6
|
+
HEAD is now at f38508a first commit
|
7
|
+
|
8
|
+
[cruise] Start to build defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:15 GMT+05:30 2012
|
9
|
+
|
10
|
+
[cruise] Current job status: passed.
|
11
|
+
|
12
|
+
[cruise] Start to execute task: <exec command="bundle" >
|
13
|
+
<arg>install</arg>
|
14
|
+
<arg>--local</arg>
|
15
|
+
</exec>.
|
16
|
+
[cruise] setting environment variable 'CRUISE_SERVER_URL' to value 'https://localhost:8154/go' (Deprecated. Use 'GO_SERVER_URL' instead.)
|
17
|
+
[cruise] setting environment variable 'GO_SERVER_URL' to value 'https://localhost:8154/go'
|
18
|
+
[cruise] setting environment variable 'GO_PIPELINE_NAME' to value 'defaultPipeline'
|
19
|
+
[cruise] setting environment variable 'GO_PIPELINE_COUNTER' to value '1'
|
20
|
+
[cruise] setting environment variable 'GO_PIPELINE_LABEL' to value '1'
|
21
|
+
[cruise] setting environment variable 'GO_STAGE_NAME' to value 'Units'
|
22
|
+
[cruise] setting environment variable 'GO_STAGE_COUNTER' to value '1'
|
23
|
+
[cruise] setting environment variable 'GO_JOB_NAME' to value 'Test'
|
24
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_NAME' to value 'defaultPipeline' (Deprecated. Use 'GO_PIPELINE_NAME' instead.)
|
25
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_COUNTER' to value '1' (Deprecated. Use 'GO_PIPELINE_COUNTER' instead.)
|
26
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_LABEL' to value '1' (Deprecated. Use 'GO_PIPELINE_LABEL' instead.)
|
27
|
+
[cruise] setting environment variable 'CRUISE_STAGE_NAME' to value 'Units' (Deprecated. Use 'GO_STAGE_NAME' instead.)
|
28
|
+
[cruise] setting environment variable 'CRUISE_STAGE_COUNTER' to value '1' (Deprecated. Use 'GO_STAGE_COUNTER' instead.)
|
29
|
+
[cruise] setting environment variable 'CRUISE_JOB_NAME' to value 'Test' (Deprecated. Use 'GO_JOB_NAME' instead.)
|
30
|
+
[cruise] setting environment variable 'GO_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
31
|
+
[cruise] setting environment variable 'GO_TO_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
32
|
+
[cruise] setting environment variable 'GO_FROM_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
33
|
+
[cruise] setting environment variable 'CRUISE_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6' (Deprecated. Use 'GO_REVISION' instead.)
|
34
|
+
[31mCould not locate Gemfile[0m
|
35
|
+
|
36
|
+
[cruise] Start to create properties defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
37
|
+
|
38
|
+
[cruise] Start to upload defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
39
|
+
|
40
|
+
[cruise] Job completed defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
41
|
+
|
42
|
+
[cruise] Start to prepare defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:37 GMT+05:30 2012
|
43
|
+
|
44
|
+
[cruise] Start updating files at revision 9f77888d7a594699894a17f4d61fc9dfac3cfb74 from git@github.com:oogabooga/zinger.git
|
45
|
+
HEAD is now at 9f77888 Update README
|
46
|
+
|
47
|
+
[cruise] Start to build defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
48
|
+
|
49
|
+
[cruise] Current job status: passed.
|
50
|
+
|
51
|
+
[cruise] Start to execute task: <exec command="bundle" >
|
52
|
+
<arg>install</arg>
|
53
|
+
<arg>--local</arg>
|
54
|
+
</exec>.
|
55
|
+
[cruise] setting environment variable 'CRUISE_SERVER_URL' to value 'https://localhost:8154/go' (Deprecated. Use 'GO_SERVER_URL' instead.)
|
56
|
+
[cruise] setting environment variable 'GO_SERVER_URL' to value 'https://localhost:8154/go'
|
57
|
+
[cruise] setting environment variable 'GO_PIPELINE_NAME' to value 'defaultPipeline'
|
58
|
+
[cruise] setting environment variable 'GO_PIPELINE_COUNTER' to value '1'
|
59
|
+
[cruise] setting environment variable 'GO_PIPELINE_LABEL' to value '1'
|
60
|
+
[cruise] setting environment variable 'GO_STAGE_NAME' to value 'Units'
|
61
|
+
[cruise] setting environment variable 'GO_STAGE_COUNTER' to value '1'
|
62
|
+
[cruise] setting environment variable 'GO_JOB_NAME' to value 'Test'
|
63
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_NAME' to value 'defaultPipeline' (Deprecated. Use 'GO_PIPELINE_NAME' instead.)
|
64
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_COUNTER' to value '1' (Deprecated. Use 'GO_PIPELINE_COUNTER' instead.)
|
65
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_LABEL' to value '1' (Deprecated. Use 'GO_PIPELINE_LABEL' instead.)
|
66
|
+
[cruise] setting environment variable 'CRUISE_STAGE_NAME' to value 'Units' (Deprecated. Use 'GO_STAGE_NAME' instead.)
|
67
|
+
[cruise] setting environment variable 'CRUISE_STAGE_COUNTER' to value '1' (Deprecated. Use 'GO_STAGE_COUNTER' instead.)
|
68
|
+
[cruise] setting environment variable 'CRUISE_JOB_NAME' to value 'Test' (Deprecated. Use 'GO_JOB_NAME' instead.)
|
69
|
+
[cruise] setting environment variable 'GO_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
70
|
+
[cruise] setting environment variable 'GO_TO_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
71
|
+
[cruise] setting environment variable 'GO_FROM_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
72
|
+
[cruise] setting environment variable 'CRUISE_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74' (Deprecated. Use 'GO_REVISION' instead.)
|
73
|
+
Error happened while attempting to execute 'bundle install --local'.
|
74
|
+
Please make sure [bundle] can be executed on this agent.
|
75
|
+
|
76
|
+
[Debug Information] Environment variable PATH: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
|
77
|
+
|
78
|
+
[cruise] Start to create properties defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
79
|
+
|
80
|
+
[cruise] Start to upload defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
81
|
+
|
82
|
+
[cruise] Job completed defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
[cruise] Start to prepare defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:06 GMT+05:30 2012
|
3
|
+
|
4
|
+
[cruise] Start updating files at revision f38508a26e1dc27737eb760e39a6aa8220f8b8c6 from git@github.com:oogabooga/zinger.git
|
5
|
+
Cloning into '/Users/saas/go-agent-12.1.0/pipelines/defaultPipeline'...
|
6
|
+
HEAD is now at f38508a first commit
|
7
|
+
|
8
|
+
[cruise] Start to build defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:15 GMT+05:30 2012
|
9
|
+
|
10
|
+
[cruise] Current job status: passed.
|
11
|
+
|
12
|
+
[cruise] Start to execute task: <exec command="bundle" >
|
13
|
+
<arg>install</arg>
|
14
|
+
<arg>--local</arg>
|
15
|
+
</exec>.
|
16
|
+
[cruise] setting environment variable 'CRUISE_SERVER_URL' to value 'https://localhost:8154/go' (Deprecated. Use 'GO_SERVER_URL' instead.)
|
17
|
+
[cruise] setting environment variable 'GO_SERVER_URL' to value 'https://localhost:8154/go'
|
18
|
+
[cruise] setting environment variable 'GO_PIPELINE_NAME' to value 'defaultPipeline'
|
19
|
+
[cruise] setting environment variable 'GO_PIPELINE_COUNTER' to value '1'
|
20
|
+
[cruise] setting environment variable 'GO_PIPELINE_LABEL' to value '1'
|
21
|
+
[cruise] setting environment variable 'GO_STAGE_NAME' to value 'Units'
|
22
|
+
[cruise] setting environment variable 'GO_STAGE_COUNTER' to value '1'
|
23
|
+
[cruise] setting environment variable 'GO_JOB_NAME' to value 'Test'
|
24
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_NAME' to value 'defaultPipeline' (Deprecated. Use 'GO_PIPELINE_NAME' instead.)
|
25
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_COUNTER' to value '1' (Deprecated. Use 'GO_PIPELINE_COUNTER' instead.)
|
26
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_LABEL' to value '1' (Deprecated. Use 'GO_PIPELINE_LABEL' instead.)
|
27
|
+
[cruise] setting environment variable 'CRUISE_STAGE_NAME' to value 'Units' (Deprecated. Use 'GO_STAGE_NAME' instead.)
|
28
|
+
[cruise] setting environment variable 'CRUISE_STAGE_COUNTER' to value '1' (Deprecated. Use 'GO_STAGE_COUNTER' instead.)
|
29
|
+
[cruise] setting environment variable 'CRUISE_JOB_NAME' to value 'Test' (Deprecated. Use 'GO_JOB_NAME' instead.)
|
30
|
+
[cruise] setting environment variable 'GO_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
31
|
+
[cruise] setting environment variable 'GO_TO_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
32
|
+
[cruise] setting environment variable 'GO_FROM_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6'
|
33
|
+
[cruise] setting environment variable 'CRUISE_REVISION' to value 'f38508a26e1dc27737eb760e39a6aa8220f8b8c6' (Deprecated. Use 'GO_REVISION' instead.)
|
34
|
+
[31mCould not locate Gemfile[0m
|
35
|
+
|
36
|
+
[cruise] Start to create properties defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
37
|
+
|
38
|
+
[cruise] Start to upload defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
39
|
+
|
40
|
+
[cruise] Job completed defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/saas/go-agent-12.1.0] at Tue Feb 21 15:42:16 GMT+05:30 2012
|
41
|
+
|
42
|
+
[cruise] Start to prepare defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:37 GMT+05:30 2012
|
43
|
+
|
44
|
+
[cruise] Start updating files at revision 9f77888d7a594699894a17f4d61fc9dfac3cfb74 from git@github.com:oogabooga/zinger.git
|
45
|
+
HEAD is now at 9f77888 Update README
|
46
|
+
|
47
|
+
[cruise] Start to build defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
48
|
+
|
49
|
+
[cruise] Current job status: passed.
|
50
|
+
|
51
|
+
[cruise] Start to execute task: <exec command="bundle" >
|
52
|
+
<arg>install</arg>
|
53
|
+
<arg>--local</arg>
|
54
|
+
</exec>.
|
55
|
+
[cruise] setting environment variable 'CRUISE_SERVER_URL' to value 'https://localhost:8154/go' (Deprecated. Use 'GO_SERVER_URL' instead.)
|
56
|
+
[cruise] setting environment variable 'GO_SERVER_URL' to value 'https://localhost:8154/go'
|
57
|
+
[cruise] setting environment variable 'GO_PIPELINE_NAME' to value 'defaultPipeline'
|
58
|
+
[cruise] setting environment variable 'GO_PIPELINE_COUNTER' to value '1'
|
59
|
+
[cruise] setting environment variable 'GO_PIPELINE_LABEL' to value '1'
|
60
|
+
[cruise] setting environment variable 'GO_STAGE_NAME' to value 'Units'
|
61
|
+
[cruise] setting environment variable 'GO_STAGE_COUNTER' to value '1'
|
62
|
+
[cruise] setting environment variable 'GO_JOB_NAME' to value 'Test'
|
63
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_NAME' to value 'defaultPipeline' (Deprecated. Use 'GO_PIPELINE_NAME' instead.)
|
64
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_COUNTER' to value '1' (Deprecated. Use 'GO_PIPELINE_COUNTER' instead.)
|
65
|
+
[cruise] setting environment variable 'CRUISE_PIPELINE_LABEL' to value '1' (Deprecated. Use 'GO_PIPELINE_LABEL' instead.)
|
66
|
+
[cruise] setting environment variable 'CRUISE_STAGE_NAME' to value 'Units' (Deprecated. Use 'GO_STAGE_NAME' instead.)
|
67
|
+
[cruise] setting environment variable 'CRUISE_STAGE_COUNTER' to value '1' (Deprecated. Use 'GO_STAGE_COUNTER' instead.)
|
68
|
+
[cruise] setting environment variable 'CRUISE_JOB_NAME' to value 'Test' (Deprecated. Use 'GO_JOB_NAME' instead.)
|
69
|
+
[cruise] setting environment variable 'GO_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
70
|
+
[cruise] setting environment variable 'GO_TO_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
71
|
+
[cruise] setting environment variable 'GO_FROM_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74'
|
72
|
+
[cruise] setting environment variable 'CRUISE_REVISION' to value '9f77888d7a594699894a17f4d61fc9dfac3cfb74' (Deprecated. Use 'GO_REVISION' instead.)
|
73
|
+
Error happened while attempting to execute 'bundle install --local'.
|
74
|
+
Please make sure [bundle] can be executed on this agent.
|
75
|
+
|
76
|
+
[Debug Information] Environment variable PATH: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
|
77
|
+
|
78
|
+
[cruise] Start to create properties defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
79
|
+
|
80
|
+
[cruise] Start to upload defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
81
|
+
|
82
|
+
[cruise] Job completed defaultPipeline/1/Units/1/Test on ira.corporate.thoughtworks.com [/Users/go/go-agent-12.1.0] at Thu Feb 23 17:16:41 GMT+05:30 2012
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
|
3
|
+
<job name="Test">
|
4
|
+
<link rel="self" href="http://localhost:8153/go/api/jobs/1.xml"/>
|
5
|
+
<id><![CDATA[urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1:Units:1:Test]]></id>
|
6
|
+
<pipeline name="defaultPipeline" counter="1" label="1"/>
|
7
|
+
<stage name="Units" counter="1" href="http://localhost:8153/go/api/stages/1.xml"/>
|
8
|
+
<result>Failed</result>
|
9
|
+
<state>Completed</state>
|
10
|
+
<properties>
|
11
|
+
<property name="cruise_agent"><![CDATA[ira.corporate.thoughtworks.com]]></property>
|
12
|
+
<property name="cruise_job_duration"><![CDATA[0]]></property>
|
13
|
+
<property name="cruise_job_id"><![CDATA[1]]></property>
|
14
|
+
<property name="cruise_job_result"><![CDATA[Failed]]></property>
|
15
|
+
<property name="cruise_pipeline_counter"><![CDATA[1]]></property>
|
16
|
+
<property name="cruise_pipeline_label"><![CDATA[1]]></property>
|
17
|
+
<property name="cruise_stage_counter"><![CDATA[1]]></property>
|
18
|
+
<property name="cruise_timestamp_01_scheduled"><![CDATA[2012-02-23T17:16:15+05:30]]></property>
|
19
|
+
<property name="cruise_timestamp_02_assigned"><![CDATA[2012-02-23T17:16:27+05:30]]></property>
|
20
|
+
<property name="cruise_timestamp_03_preparing"><![CDATA[2012-02-23T17:16:37+05:30]]></property>
|
21
|
+
<property name="cruise_timestamp_04_building"><![CDATA[2012-02-23T17:16:41+05:30]]></property>
|
22
|
+
<property name="cruise_timestamp_05_completing"><![CDATA[2012-02-23T17:16:41+05:30]]></property>
|
23
|
+
<property name="cruise_timestamp_06_completed"><![CDATA[2012-02-23T17:16:41+05:30]]></property>
|
24
|
+
</properties>
|
25
|
+
<agent uuid="c62d482a-791d-4fa4-adc3-a0808a73dd3c"/>
|
26
|
+
<artifacts baseUri="http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test" pathFromArtifactRoot="pipelines/defaultPipeline/1/Units/1/Test"/>
|
27
|
+
<resources/>
|
28
|
+
<environmentvariables/>
|
29
|
+
</job>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
|
3
|
+
<job name="Test">
|
4
|
+
<link rel="self" href="http://localhost:8153/go/api/jobs/2.xml"/>
|
5
|
+
<id><![CDATA[urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1:Acceptance:1:Test]]></id>
|
6
|
+
<pipeline name="defaultPipeline" counter="1" label="1"/>
|
7
|
+
<stage name="Acceptance" counter="1" href="http://localhost:8153/go/api/stages/2.xml"/>
|
8
|
+
<result>Failed</result>
|
9
|
+
<state>Completed</state>
|
10
|
+
<properties>
|
11
|
+
<property name="cruise_agent"><![CDATA[ira.corporate.thoughtworks.com]]></property>
|
12
|
+
<property name="cruise_job_duration"><![CDATA[0]]></property>
|
13
|
+
<property name="cruise_job_id"><![CDATA[2]]></property>
|
14
|
+
<property name="cruise_job_result"><![CDATA[Failed]]></property>
|
15
|
+
<property name="cruise_pipeline_counter"><![CDATA[1]]></property>
|
16
|
+
<property name="cruise_pipeline_label"><![CDATA[1]]></property>
|
17
|
+
<property name="cruise_stage_counter"><![CDATA[1]]></property>
|
18
|
+
<property name="cruise_timestamp_01_scheduled"><![CDATA[2012-02-23T17:19:09+05:30]]></property>
|
19
|
+
<property name="cruise_timestamp_02_assigned"><![CDATA[2012-02-23T17:19:17+05:30]]></property>
|
20
|
+
<property name="cruise_timestamp_03_preparing"><![CDATA[2012-02-23T17:19:27+05:30]]></property>
|
21
|
+
<property name="cruise_timestamp_04_building"><![CDATA[2012-02-23T17:19:31+05:30]]></property>
|
22
|
+
<property name="cruise_timestamp_05_completing"><![CDATA[2012-02-23T17:19:31+05:30]]></property>
|
23
|
+
<property name="cruise_timestamp_06_completed"><![CDATA[2012-02-23T17:19:31+05:30]]></property>
|
24
|
+
</properties>
|
25
|
+
<agent uuid="c62d482a-791d-4fa4-adc3-a0808a73dd3c"/>
|
26
|
+
<artifacts baseUri="http://localhost:8153/go/files/defaultPipeline/1/Acceptance/1/Test" pathFromArtifactRoot="pipelines/defaultPipeline/1/Acceptance/1/Test"/>
|
27
|
+
<resources/>
|
28
|
+
<environmentvariables/>
|
29
|
+
</job>
|
@@ -2,11 +2,16 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class IntegrationTest < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
5
|
+
def setup()
|
6
6
|
stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml").to_return(:body => file_contents("stages.xml"))
|
7
7
|
stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
|
8
8
|
stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
|
9
9
|
stub_request(:get, "http://localhost:8153/go/api/stages/2.xml").to_return(:body => file_contents("stages_2.xml"))
|
10
|
+
stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
|
11
|
+
stub_request(:get, "http://localhost:8153/go/api/jobs/2.xml").to_return(:body => file_contents("jobs_2.xml"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_end_to_end
|
10
15
|
pipelines = GoApiClient.runs("localhost:8153")
|
11
16
|
stages = pipelines.first.stages
|
12
17
|
|
@@ -20,9 +25,9 @@ class IntegrationTest < Test::Unit::TestCase
|
|
20
25
|
assert_equal "Acceptance", stages.first.name
|
21
26
|
assert_equal "Units", stages.last.name
|
22
27
|
assert_equal ["Update README"], pipelines.first.commit_messages
|
23
|
-
end
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
assert_not_nil stages.first.jobs.first
|
30
|
+
assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Acceptance/1/Test/cruise-output/console.log", stages.first.jobs.first.console_log_url
|
31
|
+
assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test/cruise-output/console.log", stages.last.jobs.first.console_log_url
|
27
32
|
end
|
28
33
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-27 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &2211000320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2211000320
|
25
25
|
description: This gem parses atom feed generated by the Go Continuous Integration
|
26
26
|
server and provides an OO representation of the pipelines and stages.
|
27
27
|
email:
|
@@ -43,9 +43,14 @@ files:
|
|
43
43
|
- lib/go_api_client/atom/author.rb
|
44
44
|
- lib/go_api_client/atom/entry.rb
|
45
45
|
- lib/go_api_client/atom/feed.rb
|
46
|
-
- lib/go_api_client/
|
47
|
-
- lib/go_api_client/
|
46
|
+
- lib/go_api_client/job.rb
|
47
|
+
- lib/go_api_client/pipeline.rb
|
48
|
+
- lib/go_api_client/stage.rb
|
48
49
|
- lib/go_api_client/version.rb
|
50
|
+
- test/fixtures/job_1_console.log.txt
|
51
|
+
- test/fixtures/job_2_console.log.txt
|
52
|
+
- test/fixtures/jobs_1.xml
|
53
|
+
- test/fixtures/jobs_2.xml
|
49
54
|
- test/fixtures/pipelines_1.xml
|
50
55
|
- test/fixtures/stages.xml
|
51
56
|
- test/fixtures/stages_1.xml
|
@@ -77,6 +82,10 @@ signing_key:
|
|
77
82
|
specification_version: 3
|
78
83
|
summary: Client to parse Go CI atom feed
|
79
84
|
test_files:
|
85
|
+
- test/fixtures/job_1_console.log.txt
|
86
|
+
- test/fixtures/job_2_console.log.txt
|
87
|
+
- test/fixtures/jobs_1.xml
|
88
|
+
- test/fixtures/jobs_2.xml
|
80
89
|
- test/fixtures/pipelines_1.xml
|
81
90
|
- test/fixtures/stages.xml
|
82
91
|
- test/fixtures/stages_1.xml
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
module GoApiClient
|
3
|
-
class StubHttpFetcher
|
4
|
-
# Careful : this will respond to any call with nil
|
5
|
-
class HashStruct < OpenStruct
|
6
|
-
def [](key)
|
7
|
-
self.headers[key]
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module Response
|
12
|
-
def invoked!
|
13
|
-
@invoked = true
|
14
|
-
end
|
15
|
-
|
16
|
-
def invoked?
|
17
|
-
!!@invoked
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class StringResponse
|
22
|
-
include Response
|
23
|
-
def initialize(content, code = 200, headers = {})
|
24
|
-
@content = content
|
25
|
-
@code = code.to_s
|
26
|
-
@headers = headers
|
27
|
-
end
|
28
|
-
|
29
|
-
def execute
|
30
|
-
HashStruct.new(:body => @content, :code => @code, :headers => @headers)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
class ErrorResponse
|
36
|
-
include Response
|
37
|
-
def initialize(error)
|
38
|
-
@error = error
|
39
|
-
end
|
40
|
-
|
41
|
-
def execute
|
42
|
-
raise @error
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def get(url)
|
47
|
-
if body = interweb[:get][url]
|
48
|
-
body.invoked!
|
49
|
-
return body.execute
|
50
|
-
else
|
51
|
-
raise "404 - Could not find #{url}. Available URLs are #{@interweb[:get].keys.inspect}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def post(url, params = {})
|
56
|
-
if body = interweb[:post][url]
|
57
|
-
response = body.execute
|
58
|
-
if response.headers == params
|
59
|
-
body.invoked!
|
60
|
-
return response
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
raise "404 - Could not find a url listening to #{url.inspect} that responds to post params #{params.inspect}. Available URLs are #{@interweb[:post].keys.inspect}"
|
65
|
-
end
|
66
|
-
|
67
|
-
def invoked?(url, type = :get, params = {})
|
68
|
-
if body = interweb[type][url]
|
69
|
-
response = body.execute
|
70
|
-
if response.headers == params
|
71
|
-
|
72
|
-
body.invoked?
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def register_content(content, url, type = :get, headers = {})
|
78
|
-
interweb[type][url] = StringResponse.new(content, 200, headers)
|
79
|
-
end
|
80
|
-
|
81
|
-
def register_error(url, type = :get, error)
|
82
|
-
interweb[type][url] = ErrorResponse.new(error)
|
83
|
-
end
|
84
|
-
|
85
|
-
def interweb
|
86
|
-
@interweb ||= {:get => {}, :post => {}}
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
data/lib/go_api_client/test.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'go_api_client/test/stub_http_fetcher.rb'
|