Class: DeepThought::CIService::Janky

Inherits:
CIService
  • Object
show all
Defined in:
lib/deep_thought/ci_service/janky.rb

Instance Attribute Summary

Attributes inherited from CIService

#endpoint, #password, #username

Instance Method Summary collapse

Methods inherited from CIService

#initialize, #setup?

Constructor Details

This class inherits a constructor from DeepThought::CIService::CIService

Instance Method Details

#is_branch_green?(app, branch, hash) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/deep_thought/ci_service/janky.rb', line 7

def is_branch_green?(app, branch, hash)
  is_green = false

  response = HTTParty.get("#{@endpoint}/_hubot/#{app}/#{branch}", {:basic_auth => {:username => @username, :password => @password}})
  builds = JSON.parse(response.body)

  builds.each do |build|
    if build['sha1'].to_s == hash.to_s
      if build['green']
        is_green = true
      end

      break
    end
  end

  is_green
end