lobot 2.0.0pre → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. data/.gitignore +7 -10
  2. data/.gitmodules +1 -1
  3. data/.pairs +15 -0
  4. data/.rvmrc +1 -1
  5. data/.travis.yml +5 -0
  6. data/Gemfile +2 -2
  7. data/LICENSE.txt +1 -1
  8. data/README.md +67 -29
  9. data/Rakefile +11 -6
  10. data/Vagrantfile +8 -5
  11. data/bin/lobot +2 -4
  12. data/chef/cookbooks/pivotal_ci/attributes/jenkins.rb +1 -0
  13. data/chef/cookbooks/pivotal_ci/files/default/tests/minitest/default_test.rb +40 -2
  14. data/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb +5 -0
  15. data/chef/cookbooks/pivotal_ci/recipes/jenkins_config.rb +5 -2
  16. data/chef/cookbooks/pivotal_ci/recipes/limited_travis_ci_environment.rb +4 -0
  17. data/chef/cookbooks/pivotal_ci/templates/default/jenkins-job-config.xml.erb +8 -6
  18. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/attributes/default.rb +0 -1
  19. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/bootstrap.rb +41 -0
  20. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/default.rb +1 -41
  21. data/chef/travis-cookbooks/ci_environment/apt/recipes/default.rb +8 -7
  22. data/chef/travis-cookbooks/ci_environment/bazaar/recipes/default.rb +1 -1
  23. data/chef/travis-cookbooks/ci_environment/cassandra/attributes/default.rb +6 -3
  24. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/datastax.rb +1 -1
  25. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/package.rb +1 -1
  26. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/tarball.rb +6 -2
  27. data/chef/travis-cookbooks/ci_environment/cassandra/templates/default/cassandra.init.erb +58 -131
  28. data/chef/travis-cookbooks/ci_environment/chromium/recipes/default.rb +1 -1
  29. data/chef/travis-cookbooks/ci_environment/clang/attributes/tarball.rb +2 -7
  30. data/chef/travis-cookbooks/ci_environment/clang/recipes/default.rb +1 -1
  31. data/chef/travis-cookbooks/ci_environment/clang/recipes/tarball.rb +2 -4
  32. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/default.rb +1 -1
  33. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ppa.rb +1 -1
  34. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu-12.04.rb +1 -1
  35. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1110_ppa.rb +1 -1
  36. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1204_ppa.rb +1 -1
  37. data/chef/travis-cookbooks/ci_environment/doxygen/recipes/default.rb +24 -0
  38. data/chef/travis-cookbooks/ci_environment/elasticsearch/attributes/default.rb +4 -1
  39. data/chef/travis-cookbooks/ci_environment/elasticsearch/recipes/default.rb +8 -5
  40. data/chef/travis-cookbooks/ci_environment/emacs/recipes/nox.rb +1 -1
  41. data/chef/travis-cookbooks/ci_environment/firefox/recipes/default.rb +1 -1
  42. data/chef/travis-cookbooks/ci_environment/git/recipes/default.rb +1 -1
  43. data/chef/travis-cookbooks/ci_environment/git/recipes/ppa.rb +1 -1
  44. data/chef/travis-cookbooks/ci_environment/golang/attributes/default.rb +3 -3
  45. data/chef/travis-cookbooks/ci_environment/gradle/attributes/tarball.rb +1 -1
  46. data/chef/travis-cookbooks/ci_environment/haskell/recipes/default.rb +1 -1
  47. data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_package.rb +1 -1
  48. data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_source.rb +1 -1
  49. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_package.rb +1 -1
  50. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_ppa.rb +1 -1
  51. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_source.rb +1 -1
  52. data/chef/travis-cookbooks/ci_environment/haskell/recipes/source.rb +1 -1
  53. data/chef/travis-cookbooks/ci_environment/hbase/recipes/cdh4.rb +1 -1
  54. data/chef/travis-cookbooks/ci_environment/java/attributes/default.rb +4 -2
  55. data/chef/travis-cookbooks/ci_environment/java/recipes/default.rb +1 -1
  56. data/chef/travis-cookbooks/ci_environment/java/recipes/oraclejdk7.rb +6 -1
  57. data/chef/travis-cookbooks/ci_environment/kerl/attributes/source.rb +1 -1
  58. data/chef/travis-cookbooks/ci_environment/kerl/files/default/erlang.cookie +1 -0
  59. data/chef/travis-cookbooks/ci_environment/kerl/recipes/source.rb +8 -0
  60. data/chef/travis-cookbooks/ci_environment/kestrel/recipes/tarball.rb +1 -1
  61. data/chef/travis-cookbooks/ci_environment/leiningen/attributes/default.rb +1 -1
  62. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/default.rb +1 -1
  63. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein1x.rb +1 -1
  64. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein2x.rb +1 -1
  65. data/chef/travis-cookbooks/ci_environment/libffi/recipes/default.rb +1 -1
  66. data/chef/travis-cookbooks/ci_environment/libgdbm/recipes/default.rb +1 -1
  67. data/chef/travis-cookbooks/ci_environment/libncurses/recipes/default.rb +1 -1
  68. data/chef/travis-cookbooks/ci_environment/libossp-uuid/recipes/default.rb +1 -1
  69. data/chef/travis-cookbooks/ci_environment/libreadline/recipes/default.rb +1 -1
  70. data/chef/travis-cookbooks/ci_environment/libssl/recipes/098.rb +1 -1
  71. data/chef/travis-cookbooks/ci_environment/libssl/recipes/default.rb +1 -1
  72. data/chef/travis-cookbooks/ci_environment/libxml/recipes/default.rb +1 -1
  73. data/chef/travis-cookbooks/ci_environment/lighttpd/recipes/default.rb +1 -1
  74. data/chef/travis-cookbooks/ci_environment/maven3/recipes/default.rb +5 -2
  75. data/chef/travis-cookbooks/ci_environment/maven3/recipes/package.rb +1 -1
  76. data/chef/travis-cookbooks/ci_environment/maven3/recipes/ppa.rb +1 -1
  77. data/chef/travis-cookbooks/ci_environment/maven3/recipes/tarball.rb +1 -1
  78. data/chef/travis-cookbooks/ci_environment/memcached/attributes/default.rb +1 -1
  79. data/chef/travis-cookbooks/ci_environment/memcached/attributes/ppa.rb +1 -1
  80. data/chef/travis-cookbooks/ci_environment/memcached/recipes/default.rb +1 -1
  81. data/chef/travis-cookbooks/ci_environment/memcached/recipes/ppa.rb +1 -1
  82. data/chef/travis-cookbooks/ci_environment/mercurial/recipes/default.rb +1 -1
  83. data/chef/travis-cookbooks/ci_environment/mercurial/recipes/ppa.rb +36 -0
  84. data/chef/travis-cookbooks/ci_environment/mongodb/attributes/mongodb.rb +1 -1
  85. data/chef/travis-cookbooks/ci_environment/mongodb/files/default/mongodb.sysvinit.sh +1 -1
  86. data/chef/travis-cookbooks/ci_environment/mongodb/recipes/apt.rb +5 -5
  87. data/chef/travis-cookbooks/ci_environment/mongodb/recipes/server.rb +5 -2
  88. data/chef/travis-cookbooks/ci_environment/mysql/attributes/default.rb +1 -3
  89. data/chef/travis-cookbooks/ci_environment/mysql/recipes/server_on_ramfs.rb +6 -1
  90. data/chef/travis-cookbooks/ci_environment/mysql/templates/default/my.cnf.erb +0 -2
  91. data/chef/travis-cookbooks/ci_environment/mysql/templates/default/ramfs/my.cnf.erb +0 -2
  92. data/chef/travis-cookbooks/ci_environment/neo4j-server/attributes/tarball.rb +13 -2
  93. data/chef/travis-cookbooks/ci_environment/neo4j-server/recipes/tarball.rb +26 -2
  94. data/chef/travis-cookbooks/ci_environment/networking_basic/recipes/default.rb +4 -1
  95. data/chef/travis-cookbooks/ci_environment/nodejs/attributes/multi.rb +3 -3
  96. data/chef/travis-cookbooks/ci_environment/nodejs/recipes/multi.rb +1 -1
  97. data/chef/travis-cookbooks/ci_environment/openssh/recipes/default.rb +1 -1
  98. data/chef/travis-cookbooks/ci_environment/perlbrew/attributes/multi.rb +1 -1
  99. data/chef/travis-cookbooks/ci_environment/phantomjs/attributes/default.rb +2 -2
  100. data/chef/travis-cookbooks/ci_environment/phantomjs/metadata.rb +3 -0
  101. data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/default.rb +3 -1
  102. data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/tarball.rb +3 -2
  103. data/chef/travis-cookbooks/ci_environment/php/attributes/default.rb +40 -2
  104. data/chef/travis-cookbooks/ci_environment/php/providers/pecl.rb +73 -0
  105. data/chef/travis-cookbooks/ci_environment/php/recipes/extensions.rb +25 -0
  106. data/chef/travis-cookbooks/ci_environment/php/recipes/multi.rb +5 -4
  107. data/chef/travis-cookbooks/ci_environment/php/resources/pecl.rb +10 -0
  108. data/chef/travis-cookbooks/ci_environment/phpbuild/attributes/default.rb +2 -2
  109. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/after-install.d/phpunit.sh +58 -0
  110. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.2.17 +3 -1
  111. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.3.3 +2 -1
  112. data/chef/travis-cookbooks/ci_environment/phpbuild/providers/build.rb +1 -1
  113. data/chef/travis-cookbooks/ci_environment/phpbuild/recipes/default.rb +8 -10
  114. data/chef/travis-cookbooks/ci_environment/phpbuild/templates/default/default_configure_options.erb +4 -0
  115. data/chef/travis-cookbooks/ci_environment/phpenv/attributes/default.rb +6 -0
  116. data/chef/travis-cookbooks/ci_environment/phpenv/recipes/default.rb +11 -7
  117. data/chef/travis-cookbooks/ci_environment/postgresql/recipes/server_on_ramfs.rb +2 -2
  118. data/chef/travis-cookbooks/ci_environment/python/attributes/default.rb +2 -2
  119. data/chef/travis-cookbooks/ci_environment/python/recipes/multi.rb +10 -3
  120. data/chef/travis-cookbooks/ci_environment/rabbitmq/attributes/default.rb +3 -0
  121. data/chef/travis-cookbooks/ci_environment/rabbitmq/recipes/default.rb +6 -2
  122. data/chef/travis-cookbooks/ci_environment/ragel/recipes/custom.rb +1 -1
  123. data/chef/travis-cookbooks/ci_environment/ragel/recipes/default.rb +1 -1
  124. data/chef/travis-cookbooks/ci_environment/redis/attributes/default.rb +3 -0
  125. data/chef/travis-cookbooks/ci_environment/redis/recipes/default.rb +6 -3
  126. data/chef/travis-cookbooks/ci_environment/redis/recipes/ppa.rb +1 -1
  127. data/chef/travis-cookbooks/ci_environment/riak/attributes/default.rb +1 -0
  128. data/chef/travis-cookbooks/ci_environment/riak/attributes/package.rb +3 -3
  129. data/chef/travis-cookbooks/{messaging_broker/openssl/recipes/default.rb → ci_environment/riak/attributes/service.rb} +4 -3
  130. data/chef/travis-cookbooks/ci_environment/riak/recipes/config.rb +2 -2
  131. data/chef/travis-cookbooks/ci_environment/riak/recipes/default.rb +12 -5
  132. data/chef/travis-cookbooks/ci_environment/rvm/attributes/default.rb +1 -1
  133. data/chef/travis-cookbooks/ci_environment/rvm/attributes/multi.rb +2 -0
  134. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/global.gems +1 -1
  135. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/jruby/global.gems +1 -1
  136. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/2.0.0/global.gems +2 -0
  137. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/head/global.gems +2 -0
  138. data/chef/travis-cookbooks/ci_environment/rvm/recipes/default.rb +23 -1
  139. data/chef/travis-cookbooks/ci_environment/rvm/recipes/multi.rb +2 -2
  140. data/chef/travis-cookbooks/ci_environment/rvm/templates/default/bundler_config.yml.erb +2 -0
  141. data/chef/travis-cookbooks/ci_environment/sbt/CHANGELOG.md +20 -0
  142. data/chef/travis-cookbooks/ci_environment/sbt/LICENSE +201 -0
  143. data/chef/travis-cookbooks/ci_environment/sbt/README.md +78 -2
  144. data/chef/travis-cookbooks/ci_environment/sbt/attributes/default.rb +36 -10
  145. data/chef/travis-cookbooks/ci_environment/sbt/metadata.json +27 -17
  146. data/chef/travis-cookbooks/ci_environment/sbt/metadata.rb +13 -6
  147. data/chef/travis-cookbooks/ci_environment/sbt/recipes/default.rb +101 -51
  148. data/chef/travis-cookbooks/ci_environment/sbt/templates/default/jvmopts.erb +7 -0
  149. data/chef/travis-cookbooks/ci_environment/sbt/templates/default/sbtopts.erb +54 -0
  150. data/chef/travis-cookbooks/ci_environment/sphinx/attributes/default.rb +2 -2
  151. data/chef/travis-cookbooks/ci_environment/sphinx/metadata.rb +4 -4
  152. data/chef/travis-cookbooks/ci_environment/sphinx/recipes/all.rb +1 -1
  153. data/chef/travis-cookbooks/ci_environment/sphinx/recipes/default.rb +1 -1
  154. data/chef/travis-cookbooks/{messaging_broker/build-essential/recipes/default.rb → ci_environment/sqlite/recipes/ppa.rb} +13 -24
  155. data/chef/travis-cookbooks/ci_environment/subversion/recipes/default.rb +1 -1
  156. data/chef/travis-cookbooks/ci_environment/sweeper/recipes/default.rb +1 -1
  157. data/chef/travis-cookbooks/ci_environment/travis_build_environment/attributes/default.rb +2 -0
  158. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/ci_user.rb +2 -2
  159. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/default.rb +1 -3
  160. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/root.rb +5 -1
  161. data/chef/travis-cookbooks/ci_environment/travis_build_environment/templates/default/ci_user/{dot_bashrc.sh → dot_bashrc.sh.erb} +0 -4
  162. data/chef/travis-cookbooks/ci_environment/unarchivers/recipes/default.rb +1 -1
  163. data/chef/travis-cookbooks/ci_environment/xserver/metadata.rb +3 -0
  164. data/chef/travis-cookbooks/ci_environment/xserver/recipes/default.rb +1 -1
  165. data/chef/travis-cookbooks/ci_environment/zeromq/recipes/default.rb +6 -23
  166. data/chef/travis-cookbooks/ci_environment/zeromq/recipes/{20x.rb → ppa.rb} +14 -14
  167. data/chef/travis-cookbooks/ci_environment/zookeeper/recipes/cdh4.rb +1 -1
  168. data/chef/travis-cookbooks/worker_host/java/metadata.rb +1 -1
  169. data/chef/travis-cookbooks/worker_host/java/recipes/openjdk.rb +6 -0
  170. data/chef/travis-cookbooks/worker_host/jruby/attributes/default.rb +1 -1
  171. data/chef/travis-cookbooks/worker_host/jruby/metadata.rb +1 -1
  172. data/chef/travis-cookbooks/worker_host/jruby/recipes/default.rb +1 -0
  173. data/chef/travis-cookbooks/worker_host/monit/recipes/default.rb +21 -17
  174. data/chef/travis-cookbooks/worker_host/networking_basic/metadata.rb +1 -1
  175. data/chef/travis-cookbooks/worker_host/networking_basic/recipes/default.rb +0 -6
  176. data/chef/travis-cookbooks/worker_host/ntp/.gitignore +1 -0
  177. data/chef/travis-cookbooks/worker_host/ntp/.travis.yml +6 -0
  178. data/chef/travis-cookbooks/worker_host/ntp/CHANGELOG.md +35 -0
  179. data/chef/travis-cookbooks/worker_host/ntp/CONTRIBUTING +29 -0
  180. data/chef/travis-cookbooks/worker_host/ntp/LICENSE +201 -0
  181. data/chef/travis-cookbooks/worker_host/ntp/README.md +163 -0
  182. data/chef/travis-cookbooks/worker_host/ntp/Rakefile +19 -0
  183. data/chef/travis-cookbooks/worker_host/ntp/TESTING.md +213 -0
  184. data/chef/travis-cookbooks/worker_host/ntp/attributes/default.rb +54 -0
  185. data/chef/travis-cookbooks/{messaging_broker/rabbitmq/resources/vhost.rb → worker_host/ntp/attributes/ntpdate.rb} +6 -7
  186. data/chef/travis-cookbooks/worker_host/ntp/chefignore +19 -0
  187. data/chef/travis-cookbooks/worker_host/ntp/files/default/ntp.leapseconds +222 -0
  188. data/chef/travis-cookbooks/worker_host/ntp/metadata.json +117 -0
  189. data/chef/travis-cookbooks/worker_host/ntp/metadata.rb +45 -0
  190. data/chef/travis-cookbooks/worker_host/ntp/recipes/default.rb +50 -0
  191. data/chef/travis-cookbooks/worker_host/ntp/recipes/disable.rb +22 -0
  192. data/chef/travis-cookbooks/worker_host/ntp/recipes/ntpdate.rb +36 -0
  193. data/chef/travis-cookbooks/{messaging_broker/openssl/libraries/secure_password.rb → worker_host/ntp/recipes/undo.rb} +17 -18
  194. data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntp.conf.erb +55 -0
  195. data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntpdate.erb +14 -0
  196. data/chef/travis-cookbooks/worker_host/rvm/recipes/multi.rb +1 -1
  197. data/chef/travis-cookbooks/worker_host/travis_worker/attributes/default.rb +10 -3
  198. data/chef/travis-cookbooks/worker_host/travis_worker/files/default/signal_wrapper.rb +22 -0
  199. data/chef/travis-cookbooks/worker_host/travis_worker/metadata.rb +2 -2
  200. data/chef/travis-cookbooks/worker_host/travis_worker/recipes/bluebox.rb +97 -0
  201. data/chef/travis-cookbooks/worker_host/travis_worker/recipes/default.rb +25 -15
  202. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/sv-travis-worker-run.erb +1 -1
  203. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker-bluebox.yml.erb +21 -0
  204. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker.yml.erb +0 -4
  205. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/metadata.rb +1 -0
  206. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/bluebox.rb +15 -0
  207. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/default.rb +1 -0
  208. data/chef/travis-cookbooks/worker_host/users/recipes/default.rb +5 -0
  209. data/cookbooks/.gitkeep +3 -0
  210. data/lib/lobot.rb +8 -4
  211. data/lib/lobot/amazon.rb +33 -19
  212. data/lib/lobot/cli.rb +70 -46
  213. data/lib/lobot/config.rb +151 -19
  214. data/lib/lobot/configuration_wizard.rb +117 -0
  215. data/lib/lobot/keychain.rb +36 -0
  216. data/lib/lobot/password.rb +13 -0
  217. data/lib/lobot/sobo.rb +57 -13
  218. data/lib/lobot/templates/default_rails_build_script.sh +13 -0
  219. data/lib/lobot/version.rb +2 -2
  220. data/lobot.gemspec +4 -5
  221. data/script/bootstrap_server.sh +1 -1
  222. data/script/ci_build.sh +13 -0
  223. data/spec/assets/test_cert.crt +18 -0
  224. data/spec/fixtures/ssh_keys/vagrant_test_key +27 -0
  225. data/spec/fixtures/ssh_keys/vagrant_test_key.pub +1 -0
  226. data/spec/lib/lobot/amazon_spec.rb +80 -39
  227. data/spec/lib/lobot/cli_spec.rb +223 -154
  228. data/spec/lib/lobot/config_spec.rb +207 -5
  229. data/spec/lib/lobot/configuration_wizard_spec.rb +347 -0
  230. data/spec/lib/lobot/keychain_spec.rb +33 -0
  231. data/spec/lib/lobot/password_spec.rb +15 -0
  232. data/spec/spec_helper.rb +19 -1
  233. data/templates/Gemfile-remote +4 -0
  234. metadata +83 -100
  235. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/1.8.6/global.gems +0 -2
  236. data/chef/travis-cookbooks/ci_environment/travis_build_environment/files/default/root/dot_bashrc.sh +0 -86
  237. data/chef/travis-cookbooks/ci_environment/zeromq/attributes/default.rb +0 -7
  238. data/chef/travis-cookbooks/messaging_broker/build-essential/README.md +0 -24
  239. data/chef/travis-cookbooks/messaging_broker/build-essential/metadata.rb +0 -10
  240. data/chef/travis-cookbooks/messaging_broker/emacs/metadata.rb +0 -11
  241. data/chef/travis-cookbooks/messaging_broker/emacs/recipes/default.rb +0 -21
  242. data/chef/travis-cookbooks/messaging_broker/erlang/attributes/default.rb +0 -1
  243. data/chef/travis-cookbooks/messaging_broker/erlang/metadata.rb +0 -11
  244. data/chef/travis-cookbooks/messaging_broker/erlang/recipes/default.rb +0 -27
  245. data/chef/travis-cookbooks/messaging_broker/git/README.rdoc +0 -37
  246. data/chef/travis-cookbooks/messaging_broker/git/metadata.rb +0 -16
  247. data/chef/travis-cookbooks/messaging_broker/git/recipes/default.rb +0 -24
  248. data/chef/travis-cookbooks/messaging_broker/git/recipes/server.rb +0 -34
  249. data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-log-run.erb +0 -2
  250. data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-run.erb +0 -3
  251. data/chef/travis-cookbooks/messaging_broker/haproxy/README.md +0 -79
  252. data/chef/travis-cookbooks/messaging_broker/haproxy/attributes/default.rb +0 -22
  253. data/chef/travis-cookbooks/messaging_broker/haproxy/metadata.rb +0 -13
  254. data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/app_lb.rb +0 -50
  255. data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/default.rb +0 -42
  256. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-app_lb.cfg.erb +0 -34
  257. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-default.erb +0 -4
  258. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy.cfg.erb +0 -27
  259. data/chef/travis-cookbooks/messaging_broker/iptables/definitions/iptables_rule.rb +0 -35
  260. data/chef/travis-cookbooks/messaging_broker/iptables/files/default/rebuild-iptables +0 -284
  261. data/chef/travis-cookbooks/messaging_broker/iptables/metadata.rb +0 -10
  262. data/chef/travis-cookbooks/messaging_broker/iptables/recipes/default.rb +0 -50
  263. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_established.erb +0 -2
  264. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_icmp.erb +0 -2
  265. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/iptables_load.erb +0 -3
  266. data/chef/travis-cookbooks/messaging_broker/openssl/README.md +0 -37
  267. data/chef/travis-cookbooks/messaging_broker/openssl/metadata.rb +0 -8
  268. data/chef/travis-cookbooks/messaging_broker/rabbitmq/README.md +0 -86
  269. data/chef/travis-cookbooks/messaging_broker/rabbitmq/attributes/default.rb +0 -10
  270. data/chef/travis-cookbooks/messaging_broker/rabbitmq/metadata.rb +0 -63
  271. data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/user.rb +0 -66
  272. data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/vhost.rb +0 -34
  273. data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/cluster.rb +0 -35
  274. data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/default.rb +0 -51
  275. data/chef/travis-cookbooks/messaging_broker/rabbitmq/resources/user.rb +0 -25
  276. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/doterlang.cookie.erb +0 -1
  277. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq-env.conf.erb +0 -10
  278. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq_cluster.config.erb +0 -5
  279. data/ci_build.sh +0 -20
  280. data/docs/ci_yml.md +0 -39
  281. data/features/ci.feature +0 -29
  282. data/features/config/secrets.yml.example +0 -4
  283. data/features/step_definitions/ci_steps.rb +0 -137
  284. data/features/support/env.rb +0 -12
  285. data/lib/generators/lobot/USAGE +0 -15
  286. data/lib/generators/lobot/config_generator.rb +0 -141
  287. data/lib/generators/lobot/install_generator.rb +0 -25
  288. data/lib/generators/lobot/templates/Capfile +0 -6
  289. data/lib/generators/lobot/templates/ci.yml +0 -22
  290. data/lib/generators/lobot/templates/ci_build.sh +0 -22
  291. data/lib/generators/lobot/templates/deploy-ci.rb +0 -7
  292. data/lib/generators/lobot/templates/soloistrc +0 -23
  293. data/lib/lobot/jenkins.rb +0 -17
  294. data/lib/lobot/railtie.rb +0 -20
  295. data/lib/lobot/recipes/ci.rb +0 -78
  296. data/lib/lobot/tasks/ci.rake +0 -93
  297. data/spec/lib/lobot/jenkins_spec.rb +0 -14
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require "hashie"
2
3
 
3
4
  module Lobot
@@ -10,33 +11,98 @@ module Lobot
10
11
 
11
12
  property :instance_size, :default => 'c1.medium'
12
13
  property :ssh_port, :default => 22
13
- property :server_ssh_key, :default => File.expand_path("~/.ssh/id_rsa")
14
- property :github_ssh_key, :default => File.expand_path("~/.ssh/id_rsa")
14
+ property :server_ssh_key, :default => Proc.new { default_ssh_key }
15
+ property :github_ssh_key, :default => Proc.new { default_ssh_key }
15
16
  property :recipes, :default => ["pivotal_ci::jenkins", "pivotal_ci::limited_travis_ci_environment", "pivotal_ci"]
16
- property :cookbook_paths, :default => ['./chef/cookbooks/', './chef/travis-cookbooks/ci_environment']
17
- property :node_attributes, :default => {
18
- :travis_build_environment => {
19
- :user => "jenkins",
20
- :group => "nogroup",
21
- :home => "/var/lib/jenkins"
22
- },
23
- :nginx => {
24
- :basic_auth_user => "ci",
25
- },
26
- :jenkins => {
27
- :builds => []
28
- }
29
- }
17
+ property :cookbook_paths, :default => ['./chef/cookbooks/', './chef/travis-cookbooks/ci_environment', './chef/project-cookbooks']
18
+ property :node_attributes, :default => Proc.new { default_node_attributes }
30
19
 
31
20
  def initialize(attributes = {})
32
21
  super
33
22
  self["node_attributes"] = Hashie::Mash.new(node_attributes)
34
23
  end
35
24
 
25
+ def add_build(name, repository, branch, command)
26
+ build = {
27
+ "name" => name,
28
+ "repository" => repository,
29
+ "branch" => branch,
30
+ "command" => command,
31
+ "junit_publisher" => true
32
+ }
33
+ self.node_attributes = self.node_attributes.tap do |config|
34
+ config.jenkins.builds << build unless config.jenkins.builds.include?(build)
35
+ end
36
+ end
37
+
38
+ def github_ssh_key_path
39
+ File.expand_path(self["github_ssh_key"]) if self["github_ssh_key"]
40
+ end
41
+
42
+ def github_ssh_pubkey_path
43
+ github_ssh_key_path + ".pub" if self["github_ssh_key"]
44
+ end
45
+
46
+ def github_ssh_key
47
+ File.read(github_ssh_key_path)
48
+ end
49
+
50
+ def github_ssh_pubkey
51
+ File.read(github_ssh_pubkey_path)
52
+ end
53
+
54
+ def server_ssh_key_path
55
+ File.expand_path(self["server_ssh_key"]) if self["server_ssh_key"]
56
+ end
57
+
58
+ def server_ssh_pubkey_path
59
+ server_ssh_key_path + ".pub" if self["server_ssh_key"]
60
+ end
61
+
62
+ def server_ssh_key
63
+ File.read(server_ssh_key_path)
64
+ end
65
+
66
+ def server_ssh_pubkey
67
+ File.read(server_ssh_pubkey_path)
68
+ end
69
+
70
+ def master_url
71
+ "https://#{master}" if master
72
+ end
73
+
74
+ def jenkins_url
75
+ "https://#{CGI.escape(basic_auth_user)}:#{CGI.escape(basic_auth_password)}@#{master}" if master
76
+ end
77
+
78
+ def cc_menu_url
79
+ "#{jenkins_url}/cc.xml" if master
80
+ end
81
+
82
+ def rss_url(job_name)
83
+ master_url + "/job/#{job_name}/rssAll" if master_url
84
+ end
85
+
36
86
  def node_attributes=(attributes)
37
87
  self["node_attributes"] = Hashie::Mash.new(attributes)
38
88
  end
39
89
 
90
+ def valid?
91
+ errors.empty?
92
+ end
93
+
94
+ def errors
95
+ messages = []
96
+ if node_attributes.has_key?("jenkins")
97
+ unless node_attributes.jenkins.has_key?("builds")
98
+ messages << "[:node_attributes][:jenkins][:builds]"
99
+ end
100
+ else
101
+ messages << "[:node_attributes][:jenkins]"
102
+ end
103
+ messages.map{ |path| "your config file does not have a #{path} key" }
104
+ end
105
+
40
106
  def soloistrc
41
107
  {
42
108
  "recipes" => recipes,
@@ -51,6 +117,13 @@ module Lobot
51
117
  self
52
118
  end
53
119
 
120
+ def update(options = {})
121
+ options.each_pair do |attr, value|
122
+ self.send("#{attr}=", value)
123
+ end
124
+ save
125
+ end
126
+
54
127
  def reload
55
128
  self.class.from_file(path)
56
129
  end
@@ -61,20 +134,79 @@ module Lobot
61
134
  {
62
135
  "ssh_port" => ssh_port,
63
136
  "master" => master,
64
- "server_ssh_key" => server_ssh_key,
137
+ "server_ssh_key" => server_ssh_key_path,
65
138
  "recipes" => recipes,
66
139
  "cookbook_paths" => cookbook_paths,
67
140
  "node_attributes" => node_attributes
68
141
  }.merge(hash)
69
142
  end
70
143
 
144
+ def display
145
+ <<OOTPÜT.gsub(/(\S)\s+$/, '\1').gsub(/^\./, '')
146
+ -- ciborg configuration --
147
+ Instance ID: #{instance_id}
148
+ IP Address: #{master}
149
+ Instance size: #{instance_size}
150
+ .
151
+ Builds:
152
+ #{builds}
153
+ .
154
+ Web URL: #{master_url}
155
+ User name: #{basic_auth_user}
156
+ User password: #{basic_auth_password}
157
+ .
158
+ CC Menu URL: #{cc_menu_url}
159
+ .
160
+ OOTPÜT
161
+ end
162
+
71
163
  def self.from_file(yaml_file)
72
- config = read_config(yaml_file)
73
- self.new(config.merge(:path => yaml_file))
164
+ config = {:path => yaml_file}
165
+ config.merge!(read_config(yaml_file)) if File.exists?(yaml_file)
166
+ config.delete('keypair_name')
167
+ self.new(config)
74
168
  end
75
169
 
76
170
  def self.read_config(yaml_file)
77
171
  File.open(yaml_file, "r") { |file| YAML.load(file.read) }
78
172
  end
173
+
174
+ def basic_auth_user
175
+ node_attributes[:nginx][:basic_auth_user]
176
+ end
177
+
178
+ def basic_auth_password
179
+ node_attributes[:nginx][:basic_auth_password]
180
+ end
181
+
182
+ def builds
183
+ node_attributes[:jenkins][:builds].
184
+ map { |build| build[:name] } .
185
+ map { |build| " %-17s %s" % [build, rss_url(build)] } .
186
+ join("\n")
187
+ end
188
+
189
+ private
190
+
191
+ def self.default_ssh_key
192
+ "~/.ssh/id_rsa" if File.exists?(File.expand_path("~/.ssh/id_rsa"))
193
+ end
194
+
195
+ def self.default_node_attributes
196
+ {
197
+ :travis_build_environment => {
198
+ :user => "jenkins",
199
+ :group => "nogroup",
200
+ :home => "/var/lib/jenkins"
201
+ },
202
+ :nginx => {
203
+ :basic_auth_user => "ci",
204
+ :basic_auth_password => Lobot::Password.generate
205
+ },
206
+ :jenkins => {
207
+ :builds => []
208
+ }
209
+ }
210
+ end
79
211
  end
80
212
  end
@@ -0,0 +1,117 @@
1
+ require "thor"
2
+
3
+ module Lobot
4
+ class ConfigurationWizard < ::Thor
5
+ include Actions
6
+
7
+ DESCRIPTION_TEXT = "Sets up lobot through a series of questions"
8
+
9
+ default_task :setup
10
+
11
+ desc "setup", DESCRIPTION_TEXT
12
+ def setup
13
+ return unless yes?("It looks like you're trying to set up a CI Box. Can I help? (Yes/No)")
14
+ prompt_for_build
15
+ prompt_for_github_key
16
+ prompt_for_ssh_key
17
+ prompt_for_aws
18
+ prompt_for_basic_auth
19
+ config.save
20
+ say config.reload.display
21
+ if user_wants_to_create_instance?
22
+ create_instance
23
+ provision_server
24
+ end
25
+ end
26
+
27
+ no_tasks do
28
+ def ask_with_default(statement, default)
29
+ question = default ? "#{statement} [#{default}]:" : "#{statement}:"
30
+ answer = ask(question) || ""
31
+ answer.empty? ? default : answer
32
+ end
33
+
34
+ def prompt_for_aws
35
+ say("For your AWS Access Key and Secret, see https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key")
36
+ config.aws_key = ask_with_default("Your AWS key", config.aws_key)
37
+ config.aws_secret = ask_with_default("Your AWS secret key", config.aws_secret)
38
+ end
39
+
40
+ def prompt_for_basic_auth
41
+ config.node_attributes.nginx.basic_auth_user = ask_with_default("Your CI username", config.node_attributes.nginx.basic_auth_user)
42
+ config.node_attributes.nginx.basic_auth_password = ask_with_default("Your CI password", config.node_attributes.nginx.basic_auth_password)
43
+ end
44
+
45
+ def prompt_for_ssh_key
46
+ config.server_ssh_key = ask_with_default("Path to CI server SSH key", config.server_ssh_key_path)
47
+ end
48
+
49
+ def prompt_for_github_key
50
+ config.github_ssh_key = ask_with_default("Path to a SSH key authorized to clone the repository", config.github_ssh_key_path)
51
+ end
52
+
53
+ def prompt_for_build
54
+ build = config.node_attributes.jenkins.builds.first || {}
55
+
56
+ if this_is_a_rails_project? && prompt_for_default_rails_script
57
+ build_command = Proc.new { "script/ci_build.sh" }
58
+ copy_file('default_rails_build_script.sh', 'script/ci_build.sh')
59
+ else
60
+ build_command = Proc.new { ask_with_default("What command should be run during the build?", build["command"]) }
61
+ end
62
+
63
+ repository = ask_with_default("What is the address of your git repository?", build["repository"])
64
+ name = ask_with_default("What would you like to name your build?", build["name"])
65
+ command = build_command.call
66
+ branch = "master"
67
+
68
+ config.add_build name, repository, branch, command
69
+ end
70
+
71
+ def user_wants_to_create_instance?
72
+ return unless config.master.nil?
73
+ yes?("Would you like to start an instance on AWS now? (Yes/No)")
74
+ end
75
+
76
+ def create_instance
77
+ say("Creating instance #{config.instance_size}")
78
+ cli.create
79
+ say("Instance launched.")
80
+ end
81
+
82
+ def provision_server
83
+ return if config.reload.master.nil?
84
+ cli.bootstrap
85
+ cli.chef
86
+ end
87
+
88
+ def config
89
+ @config ||= Lobot::Config.from_file(lobot_config_path)
90
+ end
91
+ end
92
+
93
+ private
94
+
95
+ def source_paths
96
+ [File.join(File.expand_path(File.dirname(__FILE__)), "templates")] + super
97
+ end
98
+
99
+ def prompt_for_default_rails_script
100
+ return false if File.exists?('script/ci_build.sh')
101
+ yes?("It looks like this is a Rails project. Would you like to use the default Rails build script? (Yes/No)")
102
+ end
103
+
104
+ def this_is_a_rails_project?
105
+ File.exists?('script/rails')
106
+ end
107
+
108
+ def lobot_config_path
109
+ FileUtils.mkdir_p(File.join(Dir.pwd, "config"))
110
+ File.expand_path("config/lobot.yml", Dir.pwd)
111
+ end
112
+
113
+ def cli
114
+ Lobot::CLI.new
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,36 @@
1
+ require "httpclient"
2
+
3
+ module Lobot
4
+ class Keychain
5
+ attr_reader :config, :path
6
+
7
+ def initialize(keychain_path)
8
+ @path = keychain_path
9
+ end
10
+
11
+ def has_key?(key_name)
12
+ system("sudo security find-certificate -c \"#{key_name}\" #{path} > /dev/null 2>&1")
13
+ end
14
+
15
+ def fetch_remote_certificate(host)
16
+ http_client.get(host).peer_cert.to_s
17
+ end
18
+
19
+ def add_certificate(certificate)
20
+ certificate_file = Tempfile.new("lobot.crt").tap do |f|
21
+ f.write(certificate)
22
+ f.close
23
+ end
24
+
25
+ system("sudo security add-trusted-cert -d -r trustAsRoot -k /Library/Keychains/System.keychain #{certificate_file.path}")
26
+ end
27
+
28
+ private
29
+ def http_client
30
+ @http_client ||=
31
+ HTTPClient.new.tap do |hc|
32
+ hc.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,13 @@
1
+ require "haddock"
2
+
3
+ module Lobot
4
+ class Password
5
+ class << self
6
+ def generate
7
+ Haddock::Password.generate
8
+ rescue Haddock::Password::NoWordsError
9
+ return ""
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,35 +1,79 @@
1
1
  require 'net/ssh'
2
-
2
+ require 'shellwords'
3
3
  module Lobot
4
4
  class Sobo
5
- attr_reader :ip, :key
5
+ class CommandFailed < StandardError; end;
6
+
7
+ attr_reader :ip, :key, :user
6
8
  attr_writer :timeout
7
9
 
8
- def initialize(ip, key)
10
+ def initialize(ip, key, user='ubuntu')
9
11
  @ip = ip
10
12
  @key = key
13
+ @user = user
11
14
  end
12
15
 
13
16
  def timeout
14
17
  @timeout || 10000
15
18
  end
16
19
 
17
- def exec(command)
18
- Net::SSH.start(ip, "ubuntu", :keys => [key], :timeout => timeout) do |ssh|
19
- ssh.exec(command)
20
- end
20
+ def system(command)
21
+ ssh_popen4!(command, true)[2]
22
+ end
23
+
24
+ def system!(command)
25
+ result = ssh_popen4!(command, true)
26
+ raise(CommandFailed, "Failed: #{command}\n#{result[0]}\n\n#{result[1]}") unless result[2] == 0
27
+ end
28
+
29
+ def backtick(command)
30
+ ssh_popen4!(command)[0]
21
31
  end
22
32
 
23
- def exec!(command)
24
- output = nil
25
- Net::SSH.start(ip, "ubuntu", :keys => [key], :timeout => timeout) do |ssh|
26
- output = ssh.exec!(command)
33
+ def ssh_popen4!(command, streaming_output = false)
34
+ ssh = Net::SSH.start(ip, user, :keys => [key], :timeout => timeout, paranoid: false)
35
+ stdout_data = ""
36
+ stderr_data = ""
37
+ exit_code = nil
38
+ exit_signal = nil
39
+
40
+ ssh.open_channel do |channel|
41
+ channel.exec("/bin/bash -lc #{Shellwords.escape(command)}") do |ch, success|
42
+ unless success
43
+ raise "FAILED: couldn't execute command (ssh.channel.exec)"
44
+ end
45
+
46
+ channel.on_data do |ch,data|
47
+ if streaming_output
48
+ STDOUT << data
49
+ STDOUT.flush
50
+ end
51
+ stdout_data += data
52
+ end
53
+
54
+ channel.on_extended_data do |ch,type,data|
55
+ if streaming_output
56
+ STDERR << data
57
+ STDERR.flush
58
+ end
59
+ stderr_data += data
60
+ end
61
+
62
+ channel.on_request("exit-status") do |ch,data|
63
+ exit_code = data.read_long
64
+ end
65
+
66
+ channel.on_request("exit-signal") do |ch, data|
67
+ exit_signal = data.read_long
68
+ end
69
+ end
27
70
  end
28
- output
71
+ ssh.loop
72
+ [stdout_data, stderr_data, exit_code, exit_signal]
29
73
  end
30
74
 
31
75
  def upload(from, to, opts = "--exclude .git")
32
- system("rsync -avz --delete #{from} ubuntu@#{ip}:#{to} #{opts}")
76
+ Kernel.system(%Q{rsync --rsh="ssh -o 'StrictHostKeyChecking no' -i #{key}" --archive --compress --delete #{from} #{user}@#{ip}:#{to} #{opts}})
33
77
  end
34
78
  end
35
79
  end