bigrig 0.0.0 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +20 -0
  5. data/.travis.yml +3 -0
  6. data/CHANGELOG.md +19 -0
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +84 -0
  9. data/LICENSE +28 -0
  10. data/README.md +191 -0
  11. data/Rakefile +10 -0
  12. data/bigrig.gemspec +29 -0
  13. data/bin/bigrig +113 -0
  14. data/lib/bigrig/actions/destroy_action.rb +21 -0
  15. data/lib/bigrig/actions/dev_action.rb +19 -0
  16. data/lib/bigrig/actions/log_action.rb +45 -0
  17. data/lib/bigrig/actions/run_action.rb +14 -0
  18. data/lib/bigrig/actions/ship_action.rb +51 -0
  19. data/lib/bigrig/actions.rb +5 -0
  20. data/lib/bigrig/dependency_graph.rb +21 -0
  21. data/lib/bigrig/descriptor.rb +43 -0
  22. data/lib/bigrig/docker_adapter.rb +129 -0
  23. data/lib/bigrig/models/application.rb +22 -0
  24. data/lib/bigrig/models/base_model.rb +7 -0
  25. data/lib/bigrig/models/container.rb +40 -0
  26. data/lib/bigrig/models.rb +3 -0
  27. data/lib/bigrig/output_parser.rb +52 -0
  28. data/lib/bigrig/runner.rb +94 -0
  29. data/lib/bigrig/version.rb +3 -0
  30. data/lib/bigrig.rb +8 -0
  31. data/spec/bigrig/actions/destroy_action_spec.rb +55 -0
  32. data/spec/bigrig/actions/dev_action_spec.rb +17 -0
  33. data/spec/bigrig/actions/log_action_spec.rb +33 -0
  34. data/spec/bigrig/actions/run_action_spec.rb +270 -0
  35. data/spec/bigrig/actions/ship_action_spec.rb +82 -0
  36. data/spec/bigrig/dependency_graph_spec.rb +19 -0
  37. data/spec/bigrig/descriptor_spec.rb +56 -0
  38. data/spec/bigrig/docker_adapter_spec.rb +409 -0
  39. data/spec/bigrig/models/application_spec.rb +32 -0
  40. data/spec/bigrig/models/container_spec.rb +115 -0
  41. data/spec/bigrig/output_parser_spec.rb +71 -0
  42. data/spec/bigrig_spec.rb +249 -0
  43. data/spec/data/addscontainer.json +24 -0
  44. data/spec/data/build/Dockerfile +2 -0
  45. data/spec/data/build/test +0 -0
  46. data/spec/data/dev.json +26 -0
  47. data/spec/data/duplicate.json +13 -0
  48. data/spec/data/env.json +12 -0
  49. data/spec/data/hosts_ip.json +12 -0
  50. data/spec/data/hosts_name.json +11 -0
  51. data/spec/data/links.json +13 -0
  52. data/spec/data/log.json +8 -0
  53. data/spec/data/multiple.json +13 -0
  54. data/spec/data/path.json +5 -0
  55. data/spec/data/ports.json +9 -0
  56. data/spec/data/profiles.json +24 -0
  57. data/spec/data/ship.json +5 -0
  58. data/spec/data/single.json +8 -0
  59. data/spec/data/tagandpath.json +24 -0
  60. data/spec/data/tiny-image.tar +0 -0
  61. data/spec/data/volumes.json +13 -0
  62. data/spec/spec_helper.rb +104 -0
  63. data/spec/support/bigrig_vcr +8 -0
  64. data/spec/support/vcr.rb +15 -0
  65. data/spec/vcr/Bigrig_DestroyAction/_perform/given_json_with_a_single_container/and_the_container_has_exited/should_remove_the_container.yml +392 -0
  66. data/spec/vcr/Bigrig_DestroyAction/_perform/given_json_with_a_single_container/and_the_container_is_running/kills_and_removes_the_container.yml +418 -0
  67. data/spec/vcr/Bigrig_DockerAdapter/_build/builds_the_given_directory.yml +63 -0
  68. data/spec/vcr/Bigrig_DockerAdapter/_build/passes_build_input_to_a_block.yml +35 -0
  69. data/spec/vcr/Bigrig_DockerAdapter/_container_exists_/when_the_container_does_not_exist/is_false.yml +115 -0
  70. data/spec/vcr/Bigrig_DockerAdapter/_container_exists_/when_the_container_exists/is_true.yml +82 -0
  71. data/spec/vcr/Bigrig_DockerAdapter/_image_id_by_tag/when_the_image_does_not_exist/raise_a_ImageNotFoundError.yml +172 -0
  72. data/spec/vcr/Bigrig_DockerAdapter/_image_id_by_tag/when_the_image_exists/returns_the_image_id.yml +148 -0
  73. data/spec/vcr/Bigrig_DockerAdapter/_kill/given_the_container_does_not_exist/should_raise_an_error.yml +115 -0
  74. data/spec/vcr/Bigrig_DockerAdapter/_kill/given_the_container_is_running/should_kill_the_container.yml +200 -0
  75. data/spec/vcr/Bigrig_DockerAdapter/_logs/streams_logs_to_a_block.yml +163 -0
  76. data/spec/vcr/Bigrig_DockerAdapter/_pull/given_a_block_to_capture_output/should_capture_output.yml +64 -0
  77. data/spec/vcr/Bigrig_DockerAdapter/_pull/given_the_repo_does_not_exist/raises_a_RepoNotFoundError.yml +30 -0
  78. data/spec/vcr/Bigrig_DockerAdapter/_pull/given_the_repo_exists/returns_the_image_id.yml +92 -0
  79. data/spec/vcr/Bigrig_DockerAdapter/_push/given_credentials/will_pass_login_and_password.yml +254 -0
  80. data/spec/vcr/Bigrig_DockerAdapter/_push/should_push_the_image.yml +482 -0
  81. data/spec/vcr/Bigrig_DockerAdapter/_remove_container/when_the_container_does_not_exist/raises_a_ContainerNotFoundError.yml +227 -0
  82. data/spec/vcr/Bigrig_DockerAdapter/_remove_container/when_the_container_exists/should_remove_the_container.yml +222 -0
  83. data/spec/vcr/Bigrig_DockerAdapter/_remove_container/when_the_container_is_running/raises_a_ContainerRunningError.yml +80 -0
  84. data/spec/vcr/Bigrig_DockerAdapter/_remove_image/when_the_image_doesnt_exist/raises_an_error.yml +115 -0
  85. data/spec/vcr/Bigrig_DockerAdapter/_remove_image/when_the_image_exists/removes_the_image.yml +199 -0
  86. data/spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name/starts_the_container_with_the_right_name.yml +204 -0
  87. data/spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name_and_env_variables/starts_the_container_with_env_set.yml +204 -0
  88. data/spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name_and_ports/starts_the_container_with_ports_exposed.yml +230 -0
  89. data/spec/vcr/Bigrig_DockerAdapter/_running_/when_the_container_does_not_exist/returns_false.yml +115 -0
  90. data/spec/vcr/Bigrig_DockerAdapter/_running_/when_the_container_is_not_running/returns_false.yml +82 -0
  91. data/spec/vcr/Bigrig_DockerAdapter/_running_/when_the_container_is_running/returns_true.yml +103 -0
  92. data/spec/vcr/Bigrig_DockerAdapter/_tag/should_tag_the_image.yml +290 -0
  93. data/spec/vcr/Bigrig_LogAction/_perform/follows_the_log.yml +163 -0
  94. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_a_path/builds_the_image_before_starting_it.yml +310 -0
  95. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_hosts_by_ip/should_pass_hosts_to_container.yml +430 -0
  96. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_hosts_by_name/should_lookup_ips_for_hosts_with_a_hostname.yml +430 -0
  97. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_links/should_pass_links_to_the_right_container.yml +805 -0
  98. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_multiple_containers/launches_both_containers_in_parallel.yml +731 -0
  99. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_multiple_containers/spins_up_multiple_containers.yml +805 -0
  100. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_one_container/should_spin_up_a_single_container.yml +404 -0
  101. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_one_container/when_a_dead_container_exists/should_remove_existing_containers.yml +329 -0
  102. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_volumes_from/should_pass_volumes_from_to_the_right_container.yml +805 -0
  103. data/spec/vcr/Bigrig_RunAction/_perform/given_a_file_with_volumes_from/starts_the_dependant_container_last.yml +731 -0
  104. data/spec/vcr/Bigrig_RunAction/_perform/when_activating_profiles_that_do_not_exist/ignores_the_missing_profile.yml +409 -0
  105. data/spec/vcr/Bigrig_RunAction/_perform/with_a_file_with_active_profiles/uses_the_overridden_image.yml +432 -0
  106. data/spec/vcr/bigrig/destroy/spec/data/single_json/kills_the_container.yml +166 -0
  107. data/spec/vcr/bigrig/dev/spec/data/dev_json/activates_the_dev_profile.yml +37 -0
  108. data/spec/vcr/bigrig/dev/spec/data/dev_json/destroys_containers_on_exit.yml +227 -0
  109. data/spec/vcr/bigrig/dev/spec/data/dev_json/starts_the_containers.yml +107 -0
  110. data/spec/vcr/bigrig/logs/spec/data/log_json/tails_the_logs.yml +163 -0
  111. data/spec/vcr/bigrig/run/spec/data/profiles_json_-p_qa/leaves_existing_env_values_alone.yml +110 -0
  112. data/spec/vcr/bigrig/run/spec/data/profiles_json_-p_qa/overrides_the_env.yml +110 -0
  113. data/spec/vcr/bigrig/run/spec/data/profiles_json_-p_qa/overrides_the_tag.yml +103 -0
  114. data/spec/vcr/bigrig/run/spec/data/single_json/sends_the_name_of_the_container_to_stdout.yml +75 -0
  115. data/spec/vcr/bigrig/run/spec/data/single_json/starts_the_container.yml +101 -0
  116. data/spec/vcr/bigrig/ship/spec/data/ship_json/with_a_version/-c/cleans_the_image_when_its_done.yml +212 -0
  117. data/spec/vcr/bigrig/ship/spec/data/ship_json/with_a_version/builds_and_pushes_the_image.yml +128 -0
  118. data/spec/vcr/bigrig_bin_bigrig_destroy_spec/data/single_json_kills_the_container.yml +179 -0
  119. data/spec/vcr/bigrig_bin_bigrig_dev_spec/data/dev_json_activates_the_dev_profile.yml +1068 -0
  120. data/spec/vcr/bigrig_bin_bigrig_dev_spec/data/dev_json_destroys_containers_on_exit.yml +1070 -0
  121. data/spec/vcr/bigrig_bin_bigrig_dev_spec/data/dev_json_starts_the_containers.yml +1068 -0
  122. data/spec/vcr/bigrig_bin_bigrig_dev_spec/data/dev_json_tails_the_logs.yml +1075 -0
  123. data/spec/vcr/bigrig_bin_bigrig_logs_spec/data/log_json_tails_the_logs.yml +69 -0
  124. data/spec/vcr/bigrig_bin_bigrig_run_spec/data/profiles_json_-p_qa_leaves_existing_env_values_alone.yml +306 -0
  125. data/spec/vcr/bigrig_bin_bigrig_run_spec/data/profiles_json_-p_qa_overrides_the_env.yml +306 -0
  126. data/spec/vcr/bigrig_bin_bigrig_run_spec/data/profiles_json_-p_qa_overrides_the_tag.yml +306 -0
  127. data/spec/vcr/bigrig_bin_bigrig_run_spec/data/single_json_sends_the_name_of_the_container_to_stdout.yml +306 -0
  128. data/spec/vcr/bigrig_bin_bigrig_run_spec/data/single_json_starts_the_container.yml +306 -0
  129. data/spec/vcr/bigrig_bin_bigrig_ship_spec/data/ship_json_with_a_version_-c_cleans_the_image_when_its_done.yml +335 -0
  130. data/spec/vcr/bigrig_bin_bigrig_ship_spec/data/ship_json_with_a_version_builds_and_pushes_the_image.yml +285 -0
  131. data/test/dev/shipper.json +24 -0
  132. data/test/logs/bigrig.json +6 -0
  133. data/test/logs/container1/Dockerfile +4 -0
  134. data/test/logs/container1/run.sh +7 -0
  135. data/test/logs/container2/Dockerfile +4 -0
  136. data/test/logs/container2/run.sh +7 -0
  137. data/test/ship/bigrig-1.2.3.json +1 -0
  138. data/test/ship/bigrig.json +5 -0
  139. data/test/ship/registry.json +11 -0
  140. data/test/ship/ship/Dockerfile +4 -0
  141. data/test/ship/ship/run.sh +6 -0
  142. data/test/volumes_from/exports_volumes/Dockerfile +8 -0
  143. data/test/volumes_from/exports_volumes/index.html +8 -0
  144. data/test/volumes_from/exports_volumes/run.sh +7 -0
  145. data/test/volumes_from/shipper.json +14 -0
  146. metadata +278 -8
@@ -0,0 +1,310 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: "<DOCKER_HOST>/v1.16/build"
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Swipely/Docker-API 1.20.0
12
+ Content-Type:
13
+ - application/tar
14
+ Transfer-Encoding:
15
+ - chunked
16
+ X-Registry-Config:
17
+ - eyJjb25maWdzIjp7IiI6eyJ1c2VybmFtZSI6IiIsInBhc3N3b3JkIjoiIiwiZW1haWwiOiIifX19
18
+ response:
19
+ status:
20
+ code: 200
21
+ message:
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 12 Mar 2015 21:37:37 GMT
27
+ body:
28
+ encoding: UTF-8
29
+ string: "{\"stream\":\"Step 0 : FROM hawknewton/true\\n\"}\r\n{\"stream\":\"
30
+ ---\\u003e 5fbce35eb337\\n\"}\r\n{\"stream\":\"Step 1 : ADD test /\\n\"}\r\n{\"stream\":\"
31
+ ---\\u003e c5ff9957f6ce\\n\"}\r\n{\"stream\":\"Removing intermediate container
32
+ 98ff4c8696ea\\n\"}\r\n{\"stream\":\"Successfully built c5ff9957f6ce\\n\"}\r\n"
33
+ http_version:
34
+ recorded_at: Thu, 12 Mar 2015 21:37:39 GMT
35
+ - request:
36
+ method: get
37
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ''
41
+ headers:
42
+ User-Agent:
43
+ - Swipely/Docker-API 1.20.0
44
+ Content-Type:
45
+ - text/plain
46
+ response:
47
+ status:
48
+ code: 404
49
+ message:
50
+ headers:
51
+ Content-Type:
52
+ - text/plain; charset=utf-8
53
+ Date:
54
+ - Thu, 12 Mar 2015 21:37:37 GMT
55
+ Content-Length:
56
+ - '28'
57
+ body:
58
+ encoding: UTF-8
59
+ string: |
60
+ No such container: build_me
61
+ http_version:
62
+ recorded_at: Thu, 12 Mar 2015 21:37:39 GMT
63
+ - request:
64
+ method: get
65
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
66
+ body:
67
+ encoding: US-ASCII
68
+ string: ''
69
+ headers:
70
+ User-Agent:
71
+ - Swipely/Docker-API 1.20.0
72
+ Content-Type:
73
+ - text/plain
74
+ response:
75
+ status:
76
+ code: 404
77
+ message:
78
+ headers:
79
+ Content-Type:
80
+ - text/plain; charset=utf-8
81
+ Date:
82
+ - Thu, 12 Mar 2015 21:37:37 GMT
83
+ Content-Length:
84
+ - '28'
85
+ body:
86
+ encoding: UTF-8
87
+ string: |
88
+ No such container: build_me
89
+ http_version:
90
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
91
+ - request:
92
+ method: get
93
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
94
+ body:
95
+ encoding: US-ASCII
96
+ string: ''
97
+ headers:
98
+ User-Agent:
99
+ - Swipely/Docker-API 1.20.0
100
+ Content-Type:
101
+ - text/plain
102
+ response:
103
+ status:
104
+ code: 404
105
+ message:
106
+ headers:
107
+ Content-Type:
108
+ - text/plain; charset=utf-8
109
+ Date:
110
+ - Thu, 12 Mar 2015 21:37:37 GMT
111
+ Content-Length:
112
+ - '28'
113
+ body:
114
+ encoding: UTF-8
115
+ string: |
116
+ No such container: build_me
117
+ http_version:
118
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
119
+ - request:
120
+ method: get
121
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
122
+ body:
123
+ encoding: US-ASCII
124
+ string: ''
125
+ headers:
126
+ User-Agent:
127
+ - Swipely/Docker-API 1.20.0
128
+ Content-Type:
129
+ - text/plain
130
+ response:
131
+ status:
132
+ code: 404
133
+ message:
134
+ headers:
135
+ Content-Type:
136
+ - text/plain; charset=utf-8
137
+ Date:
138
+ - Thu, 12 Mar 2015 21:37:37 GMT
139
+ Content-Length:
140
+ - '28'
141
+ body:
142
+ encoding: UTF-8
143
+ string: |
144
+ No such container: build_me
145
+ http_version:
146
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
147
+ - request:
148
+ method: get
149
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
150
+ body:
151
+ encoding: US-ASCII
152
+ string: ''
153
+ headers:
154
+ User-Agent:
155
+ - Swipely/Docker-API 1.20.0
156
+ Content-Type:
157
+ - text/plain
158
+ response:
159
+ status:
160
+ code: 404
161
+ message:
162
+ headers:
163
+ Content-Type:
164
+ - text/plain; charset=utf-8
165
+ Date:
166
+ - Thu, 12 Mar 2015 21:37:37 GMT
167
+ Content-Length:
168
+ - '28'
169
+ body:
170
+ encoding: UTF-8
171
+ string: |
172
+ No such container: build_me
173
+ http_version:
174
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
175
+ - request:
176
+ method: get
177
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
178
+ body:
179
+ encoding: US-ASCII
180
+ string: ''
181
+ headers:
182
+ User-Agent:
183
+ - Swipely/Docker-API 1.20.0
184
+ Content-Type:
185
+ - text/plain
186
+ response:
187
+ status:
188
+ code: 404
189
+ message:
190
+ headers:
191
+ Content-Type:
192
+ - text/plain; charset=utf-8
193
+ Date:
194
+ - Thu, 12 Mar 2015 21:37:37 GMT
195
+ Content-Length:
196
+ - '28'
197
+ body:
198
+ encoding: UTF-8
199
+ string: |
200
+ No such container: build_me
201
+ http_version:
202
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
203
+ - request:
204
+ method: get
205
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
206
+ body:
207
+ encoding: US-ASCII
208
+ string: ''
209
+ headers:
210
+ User-Agent:
211
+ - Swipely/Docker-API 1.20.0
212
+ Content-Type:
213
+ - text/plain
214
+ response:
215
+ status:
216
+ code: 404
217
+ message:
218
+ headers:
219
+ Content-Type:
220
+ - text/plain; charset=utf-8
221
+ Date:
222
+ - Thu, 12 Mar 2015 21:37:37 GMT
223
+ Content-Length:
224
+ - '28'
225
+ body:
226
+ encoding: UTF-8
227
+ string: |
228
+ No such container: build_me
229
+ http_version:
230
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
231
+ - request:
232
+ method: get
233
+ uri: "<DOCKER_HOST>/v1.16/containers/build_me/json"
234
+ body:
235
+ encoding: US-ASCII
236
+ string: ''
237
+ headers:
238
+ User-Agent:
239
+ - Swipely/Docker-API 1.20.0
240
+ Content-Type:
241
+ - text/plain
242
+ response:
243
+ status:
244
+ code: 404
245
+ message:
246
+ headers:
247
+ Content-Type:
248
+ - text/plain; charset=utf-8
249
+ Date:
250
+ - Thu, 12 Mar 2015 21:37:37 GMT
251
+ Content-Length:
252
+ - '28'
253
+ body:
254
+ encoding: UTF-8
255
+ string: |
256
+ No such container: build_me
257
+ http_version:
258
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
259
+ - request:
260
+ method: post
261
+ uri: "<DOCKER_HOST>/v1.16/containers/create?name=build_me"
262
+ body:
263
+ encoding: UTF-8
264
+ string: '{"Env":[],"Image":"c5ff9957f6ce","ExposedPorts":{}}'
265
+ headers:
266
+ User-Agent:
267
+ - Swipely/Docker-API 1.20.0
268
+ Content-Type:
269
+ - application/json
270
+ response:
271
+ status:
272
+ code: 201
273
+ message:
274
+ headers:
275
+ Content-Type:
276
+ - application/json
277
+ Date:
278
+ - Thu, 12 Mar 2015 21:37:38 GMT
279
+ Content-Length:
280
+ - '90'
281
+ body:
282
+ encoding: UTF-8
283
+ string: |
284
+ {"Id":"c01ac47fb65994b46f195432993ba77f7591b9ee48b4f8089f174595f2cd6000","Warnings":null}
285
+ http_version:
286
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
287
+ - request:
288
+ method: post
289
+ uri: "<DOCKER_HOST>/v1.16/containers/c01ac47fb65994b46f195432993ba77f7591b9ee48b4f8089f174595f2cd6000/start"
290
+ body:
291
+ encoding: UTF-8
292
+ string: '{"Links":[],"ExtraHosts":[],"PortBindings":{},"VolumesFrom":[]}'
293
+ headers:
294
+ User-Agent:
295
+ - Swipely/Docker-API 1.20.0
296
+ Content-Type:
297
+ - application/json
298
+ response:
299
+ status:
300
+ code: 204
301
+ message:
302
+ headers:
303
+ Date:
304
+ - Thu, 12 Mar 2015 21:37:38 GMT
305
+ body:
306
+ encoding: UTF-8
307
+ string: ''
308
+ http_version:
309
+ recorded_at: Thu, 12 Mar 2015 21:37:40 GMT
310
+ recorded_with: VCR 2.9.3