DIY build radiators on Raspberry Pi

De3b431e5956bcda51bbb9697399806e?s=47 tektalks
November 17, 2013

DIY build radiators on Raspberry Pi

#DevOpsDays India 2013 : DIY build radiators on Raspberry Pi

De3b431e5956bcda51bbb9697399806e?s=128

tektalks

November 17, 2013
Tweet

Transcript

  1. 9.

    Input - servers.yml - type: Snap url: https://snap-ci.com/secret/cctray.xml - type:

    Go username: user password: password url: https://example.com/cctray.xml
  2. 11.

    Controller – application.rb require 'ci_status' require 'yaml’ def ci_servers @ci_servers

    ||= YAML::load(File.read('config/servers.yml')) end ci_servers.each do |ci_server| cc = CiStatus::CruiseControl.new(ci_server['url'], ci_server['username'], ci_server['password']) builds += cc.builds end
  3. 12.

    Controller – application.rb require 'sinatra' require 'ci_status' require 'yaml’ def

    ci_servers @ci_servers ||= YAML::load(File.read('config/servers.yml')) end get '/' do builds = [] ci_servers.each do |ci_server| cc = CiStatus::CruiseControl.new(ci_server['url'], ci_server['username'], ci_server['password']) builds += cc.builds end @failed_builds, @success_builds = builds.partition { |build| build.failure? } erb ’builds.html'.to_sym end
  4. 13.

    View – builds.html.erb <html> <head> </head> <ul class="builds"> <% @failed_builds.each

    do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> <% @success_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> </ul> <html>
  5. 14.

    View – builds.html.erb <html> <head> <script> window.setTimeout(function() { window.location.reload(true); },

    10000); </script> </head> <ul class="builds"> <% @failed_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> <% @success_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> </ul> <html>
  6. 16.

    Deploy to your pi $ git clone your-build-radiator-repo.git $ bundle

    install $ bundle exec rackup Open your browser on the pi and navigate to localhost:9292
  7. 18.

    Advantages • Get fast feedback for your builds • Save

    money • Save electricity • Its cool! 