Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
work around missing full_url in jenkins payload
Browse files Browse the repository at this point in the history
This doesn't work when there are multiple Jenkins master defined but is
good enough for now. The right way to fix this would be to have each
`Janky::Builder::Client` have its own `Janky::Builder::Receiver` with
its own `url` attribute.

/cc #66 #76
  • Loading branch information
sr committed Jun 24, 2012
1 parent dad0289 commit 60ab327
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/janky/builder/payload.rb
@@ -1,14 +1,18 @@
module Janky
module Builder
class Payload
def self.parse(json)
def self.parse(json, base_url)
parsed = Yajl.load(json)
build = parsed["build"]

full_url = build["full_url"]
path = build["url"]
build_url = full_url || "#{base_url}#{path}"

new(
build["phase"],
build["parameters"]["JANKY_ID"],
build["full_url"],
build_url,
build["status"]
)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/janky/builder/receiver.rb
Expand Up @@ -3,7 +3,8 @@ module Builder
class Receiver
def self.call(env)
request = Rack::Request.new(env)
payload = Payload.parse(request.body)
default_base_url = Builder[:default].url
payload = Payload.parse(request.body, default_base_url)

if payload.started?
Build.start(payload.id, payload.url)
Expand Down

0 comments on commit 60ab327

Please sign in to comment.