Guest User

Untitled

a guest
May 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. require 'rubygems'
  4. require 'codefumes_harvester'
  5.  
  6. def cuc_success?
  7. ENV['CUC_RET'] == '0'
  8. end
  9.  
  10. def spec_success?
  11. ENV['SPEC_RET'] == '0'
  12. end
  13.  
  14. pub_key = ENV['CF_PUBLIC_KEY']
  15. priv_key = ENV['CF_PRIVATE_KEY']
  16. svn_rev = ENV['SVN_REVISION']
  17.  
  18. latest_rev = CodeFumes::Commit.latest_identifier(pub_key)
  19.  
  20. if ARGV[0] == "start"
  21. payload = CodeFumes::Payload.new(:public_key => pub_key,
  22. :private_key => priv_key,
  23. :content => {:commits => [{:identifier => svn_rev, :parent_identifiers => latest_rev}]})
  24. payload.save
  25. build = CodeFumes::Build.new(:public_key => pub_key,
  26. :private_key => priv_key,
  27. :commit_identifier => svn_rev,
  28. :name => "StandardBuild",
  29. :started_at => Time.now,
  30. :state => "running")
  31. build.save
  32. elsif ARGV[0] == "end"
  33. if cuc_success? && spec_success?
  34. status = "successful"
  35. else
  36. status = "failed"
  37. end
  38. build = CodeFumes::Build.find(:public_key => pub_key, :private_key => priv_key, :commit_identifier => latest_rev, :identifier => "StandardBuild")
  39. build.state = status
  40. build.ended_at = Time.now
  41. build.save
  42. end
Add Comment
Please, Sign In to add comment