teamcity_ruby 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/teamcity_ruby/agent_pool.rb +39 -0
- data/lib/teamcity_ruby/version.rb +1 -1
- data/lib/teamcity_ruby.rb +1 -0
- data/spec/cassettes/TeamcityRuby_AgentPool/creates_an_agent_pool.yml +299 -0
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/an_existing_build_configuration/has_a_build_step_added_to_it.yml +107 -107
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/an_existing_build_configuration/has_a_build_trigger_added_to_it.yml +95 -95
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/an_existing_build_configuration/has_a_vcs_root_attached_to_it_with_specific_checkout_rules.yml +109 -109
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/an_existing_build_configuration/has_settings_definitions.yml +107 -107
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/fetches_a_specific_build_configuration_by_id.yml +83 -83
- data/spec/cassettes/TeamcityRuby_BuildConfiguration/lists_all_build_configurations.yml +103 -169
- data/spec/cassettes/TeamcityRuby_Project/creates_a_project_copying_its_settings_from_a_source_project.yml +96 -96
- data/spec/cassettes/TeamcityRuby_Project/creates_a_project_with_a_parent_project.yml +49 -49
- data/spec/cassettes/TeamcityRuby_Project/destroys_a_specific_project.yml +69 -69
- data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_id_locator.yml +69 -69
- data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_name_locator.yml +59 -59
- data/spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml +71 -71
- data/spec/cassettes/TeamcityRuby_VcsRoot/lists_all_vcs_roots.yml +51 -51
- data/spec/spec_helper.rb +6 -0
- data/spec/teamcity_ruby/agent_pool_spec.rb +25 -0
- metadata +8 -3
@@ -0,0 +1,39 @@
|
|
1
|
+
module TeamcityRuby
|
2
|
+
class AgentPool
|
3
|
+
extend TeamcityRuby::Resource
|
4
|
+
|
5
|
+
attr_accessor :teamcity_id
|
6
|
+
|
7
|
+
url_path "/agentPools"
|
8
|
+
resource_name "agentPool"
|
9
|
+
|
10
|
+
def self.create(name, options = {})
|
11
|
+
payload = { "name" => name }.to_json
|
12
|
+
response = client.post("/agentPools", :body => payload)
|
13
|
+
new(response)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(options = {})
|
17
|
+
@teamcity_id = options["id"]
|
18
|
+
@name = options["name"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def destroy!
|
22
|
+
client.delete("/agentPools/id:#{teamcity_id}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_project(options = {})
|
26
|
+
raise "Agent pool needs a teamcity_id" unless self.teamcity_id
|
27
|
+
project_id = options.fetch(:project_id) { raise ":project_id is required" }
|
28
|
+
payload = { "id" => project_id }
|
29
|
+
response = client.post("/agentPools/id:#{self.teamcity_id}/projects", :body => payload.to_json)
|
30
|
+
end
|
31
|
+
|
32
|
+
def projects
|
33
|
+
raise "Agent pool needs a teamcity_id" unless self.teamcity_id
|
34
|
+
client.get("/agentPools/id:#{self.teamcity_id}/projects")["project"].map do |p|
|
35
|
+
Project.new(p)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/teamcity_ruby.rb
CHANGED
@@ -28,3 +28,4 @@ require File.join(directory, 'teamcity_ruby', 'element_builder')
|
|
28
28
|
require File.join(directory, 'teamcity_ruby', 'project')
|
29
29
|
require File.join(directory, 'teamcity_ruby', 'vcs_root')
|
30
30
|
require File.join(directory, 'teamcity_ruby', 'build_configuration')
|
31
|
+
require File.join(directory, 'teamcity_ruby', 'agent_pool')
|
@@ -0,0 +1,299 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/agentPools
|
6
|
+
body:
|
7
|
+
string: ""
|
8
|
+
headers:
|
9
|
+
Content-Type:
|
10
|
+
- application/json
|
11
|
+
Accept:
|
12
|
+
- application/json
|
13
|
+
response:
|
14
|
+
status:
|
15
|
+
code: 200
|
16
|
+
message: OK
|
17
|
+
headers:
|
18
|
+
Server:
|
19
|
+
- Apache-Coyote/1.1
|
20
|
+
Transfer-Encoding:
|
21
|
+
- chunked
|
22
|
+
Cache-Control:
|
23
|
+
- no-cache
|
24
|
+
- no-store
|
25
|
+
Pragma:
|
26
|
+
- no-cache
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Expires:
|
30
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
31
|
+
Date:
|
32
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
33
|
+
Set-Cookie:
|
34
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
35
|
+
- TCSESSIONID=7EDCAEB88F5E5CCC8FA95E3B3A81F019; Path=/; HttpOnly
|
36
|
+
body:
|
37
|
+
string: "{\"count\":2,\"agentPool\":[{\"id\":59,\"name\":\"Linux\",\"href\":\"/httpAuth/app/rest/agentPools/id:59\"},{\"id\":0,\"name\":\"Default\",\"href\":\"/httpAuth/app/rest/agentPools/id:0\"}]}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
40
|
+
- request:
|
41
|
+
method: delete
|
42
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/agentPools/id:59
|
43
|
+
body:
|
44
|
+
string: ""
|
45
|
+
headers:
|
46
|
+
Content-Type:
|
47
|
+
- application/json
|
48
|
+
Accept:
|
49
|
+
- application/json
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 204
|
53
|
+
message: No Content
|
54
|
+
headers:
|
55
|
+
Server:
|
56
|
+
- Apache-Coyote/1.1
|
57
|
+
Cache-Control:
|
58
|
+
- no-cache
|
59
|
+
- no-store
|
60
|
+
Pragma:
|
61
|
+
- no-cache
|
62
|
+
Expires:
|
63
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
64
|
+
Date:
|
65
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
66
|
+
Set-Cookie:
|
67
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
68
|
+
- TCSESSIONID=433462B82682429156224F4B667A4049; Path=/; HttpOnly
|
69
|
+
body:
|
70
|
+
string: ""
|
71
|
+
http_version:
|
72
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
73
|
+
- request:
|
74
|
+
method: delete
|
75
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/agentPools/id:0
|
76
|
+
body:
|
77
|
+
string: ""
|
78
|
+
headers:
|
79
|
+
Content-Type:
|
80
|
+
- application/json
|
81
|
+
Accept:
|
82
|
+
- application/json
|
83
|
+
response:
|
84
|
+
status:
|
85
|
+
code: 500
|
86
|
+
message: Internal Server Error
|
87
|
+
headers:
|
88
|
+
Server:
|
89
|
+
- Apache-Coyote/1.1
|
90
|
+
Transfer-Encoding:
|
91
|
+
- chunked
|
92
|
+
Cache-Control:
|
93
|
+
- no-cache
|
94
|
+
- no-store
|
95
|
+
Pragma:
|
96
|
+
- no-cache
|
97
|
+
Content-Type:
|
98
|
+
- text/plain
|
99
|
+
Connection:
|
100
|
+
- close
|
101
|
+
Expires:
|
102
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
103
|
+
Date:
|
104
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
105
|
+
Set-Cookie:
|
106
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
107
|
+
- TCSESSIONID=75BC9F858DB316C838B3AB0231CDC7CE; Path=/; HttpOnly
|
108
|
+
body:
|
109
|
+
string: |-
|
110
|
+
Error has occurred during request processing (Internal Server Error).
|
111
|
+
Error: java.lang.IllegalStateException: Cannot delete agent pool with id '0'., caused by: jetbrains.buildServer.serverSide.agentPools.AgentPoolCannotBeDeletedException: Default agent pool cannot be deleted
|
112
|
+
Error occurred while processing this request.
|
113
|
+
http_version:
|
114
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
115
|
+
- request:
|
116
|
+
method: get
|
117
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects
|
118
|
+
body:
|
119
|
+
string: ""
|
120
|
+
headers:
|
121
|
+
Content-Type:
|
122
|
+
- application/json
|
123
|
+
Accept:
|
124
|
+
- application/json
|
125
|
+
response:
|
126
|
+
status:
|
127
|
+
code: 200
|
128
|
+
message: OK
|
129
|
+
headers:
|
130
|
+
Server:
|
131
|
+
- Apache-Coyote/1.1
|
132
|
+
Transfer-Encoding:
|
133
|
+
- chunked
|
134
|
+
Cache-Control:
|
135
|
+
- no-cache
|
136
|
+
- no-store
|
137
|
+
Pragma:
|
138
|
+
- no-cache
|
139
|
+
Content-Type:
|
140
|
+
- application/json
|
141
|
+
Expires:
|
142
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
143
|
+
Date:
|
144
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
145
|
+
Set-Cookie:
|
146
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
147
|
+
- TCSESSIONID=9655A1860983E225ECCD34082B9C9EB5; Path=/; HttpOnly
|
148
|
+
body:
|
149
|
+
string: "{\"project\":[{\"id\":\"_Root\",\"name\":\"<Root project>\",\"href\":\"/httpAuth/app/rest/projects/id:_Root\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=_Root\"},{\"id\":\"SampleProject\",\"name\":\"Sample Project\",\"href\":\"/httpAuth/app/rest/projects/id:SampleProject\",\"archived\":false,\"webUrl\":\"http://localhost:8111/project.html?projectId=SampleProject\",\"parentProjectId\":\"_Root\"}]}"
|
150
|
+
http_version:
|
151
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
152
|
+
- request:
|
153
|
+
method: delete
|
154
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:_Root
|
155
|
+
body:
|
156
|
+
string: ""
|
157
|
+
headers:
|
158
|
+
Content-Type:
|
159
|
+
- application/json
|
160
|
+
Accept:
|
161
|
+
- application/json
|
162
|
+
response:
|
163
|
+
status:
|
164
|
+
code: 403
|
165
|
+
message: Forbidden
|
166
|
+
headers:
|
167
|
+
Server:
|
168
|
+
- Apache-Coyote/1.1
|
169
|
+
Transfer-Encoding:
|
170
|
+
- chunked
|
171
|
+
Cache-Control:
|
172
|
+
- no-cache
|
173
|
+
- no-store
|
174
|
+
Pragma:
|
175
|
+
- no-cache
|
176
|
+
Content-Type:
|
177
|
+
- text/plain
|
178
|
+
Expires:
|
179
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
180
|
+
Date:
|
181
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
182
|
+
Set-Cookie:
|
183
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
184
|
+
- TCSESSIONID=F903F5A1556A724D4F662C9496C3BBB3; Path=/; HttpOnly
|
185
|
+
body:
|
186
|
+
string: |-
|
187
|
+
Error has occurred during request processing (Forbidden).
|
188
|
+
Error: jetbrains.buildServer.serverSide.auth.AccessDeniedException: Root project cannot be removed
|
189
|
+
Access denied. Check the user has enough permissions to perform the operation.
|
190
|
+
http_version:
|
191
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
192
|
+
- request:
|
193
|
+
method: delete
|
194
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/projects/id:SampleProject
|
195
|
+
body:
|
196
|
+
string: ""
|
197
|
+
headers:
|
198
|
+
Content-Type:
|
199
|
+
- application/json
|
200
|
+
Accept:
|
201
|
+
- application/json
|
202
|
+
response:
|
203
|
+
status:
|
204
|
+
code: 204
|
205
|
+
message: No Content
|
206
|
+
headers:
|
207
|
+
Server:
|
208
|
+
- Apache-Coyote/1.1
|
209
|
+
Cache-Control:
|
210
|
+
- no-cache
|
211
|
+
- no-store
|
212
|
+
Pragma:
|
213
|
+
- no-cache
|
214
|
+
Expires:
|
215
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
216
|
+
Date:
|
217
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
218
|
+
Set-Cookie:
|
219
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
220
|
+
- TCSESSIONID=DA17A7E9FDEAC7EB55B83EF2F180A3E8; Path=/; HttpOnly
|
221
|
+
body:
|
222
|
+
string: ""
|
223
|
+
http_version:
|
224
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
225
|
+
- request:
|
226
|
+
method: post
|
227
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/agentPools
|
228
|
+
body:
|
229
|
+
string: "{\"name\":\"Linux\"}"
|
230
|
+
headers:
|
231
|
+
Content-Type:
|
232
|
+
- application/json
|
233
|
+
Accept:
|
234
|
+
- application/json
|
235
|
+
response:
|
236
|
+
status:
|
237
|
+
code: 200
|
238
|
+
message: OK
|
239
|
+
headers:
|
240
|
+
Server:
|
241
|
+
- Apache-Coyote/1.1
|
242
|
+
Transfer-Encoding:
|
243
|
+
- chunked
|
244
|
+
Cache-Control:
|
245
|
+
- no-cache
|
246
|
+
- no-store
|
247
|
+
Pragma:
|
248
|
+
- no-cache
|
249
|
+
Content-Type:
|
250
|
+
- application/json
|
251
|
+
Expires:
|
252
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
253
|
+
Date:
|
254
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
255
|
+
Set-Cookie:
|
256
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
257
|
+
- TCSESSIONID=3757C202E2DF7DD6C9B144646C311E2B; Path=/; HttpOnly
|
258
|
+
body:
|
259
|
+
string: "{\"href\":\"/httpAuth/app/rest/agentPools/id:60\",\"id\":60,\"name\":\"Linux\",\"projects\":{\"project\":[]},\"agents\":{\"count\":0,\"agent\":[]}}"
|
260
|
+
http_version:
|
261
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
262
|
+
- request:
|
263
|
+
method: get
|
264
|
+
uri: http://teamcity:teamcity@localhost:8111/httpAuth/app/rest/agentPools/id:60
|
265
|
+
body:
|
266
|
+
string: ""
|
267
|
+
headers:
|
268
|
+
Content-Type:
|
269
|
+
- application/json
|
270
|
+
Accept:
|
271
|
+
- application/json
|
272
|
+
response:
|
273
|
+
status:
|
274
|
+
code: 200
|
275
|
+
message: OK
|
276
|
+
headers:
|
277
|
+
Server:
|
278
|
+
- Apache-Coyote/1.1
|
279
|
+
Transfer-Encoding:
|
280
|
+
- chunked
|
281
|
+
Cache-Control:
|
282
|
+
- no-cache
|
283
|
+
- no-store
|
284
|
+
Pragma:
|
285
|
+
- no-cache
|
286
|
+
Content-Type:
|
287
|
+
- application/json
|
288
|
+
Expires:
|
289
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
290
|
+
Date:
|
291
|
+
- Fri, 23 May 2014 07:28:31 GMT
|
292
|
+
Set-Cookie:
|
293
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
294
|
+
- TCSESSIONID=96404C821CC716899CD608E900E66C33; Path=/; HttpOnly
|
295
|
+
body:
|
296
|
+
string: "{\"href\":\"/httpAuth/app/rest/agentPools/id:60\",\"id\":60,\"name\":\"Linux\",\"projects\":{\"project\":[]},\"agents\":{\"count\":0,\"agent\":[]}}"
|
297
|
+
http_version:
|
298
|
+
recorded_at: Fri, 23 May 2014 07:28:31 GMT
|
299
|
+
recorded_with: VCR 2.4.0
|