Page MenuHomeDevCentral

D2833.diff
No OneTemporary

D2833.diff

diff --git a/tommy.rb b/tommy.rb
--- a/tommy.rb
+++ b/tommy.rb
@@ -71,6 +71,13 @@
end
end
+
+begin
+ JENKINS_MULTI_BRANCH = !!ENV.fetch('JENKINS_MULTI_BRANCH')
+rescue KeyError
+ JENKINS_MULTI_BRANCH = false
+end
+
# -------------------------------------------------------------
# Project class
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -188,9 +195,19 @@
# Controller
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+def build_jenkins_url
+ if JENKINS_MULTI_BRANCH
+ "#{JENKINS_URL}/api/json?depth=2"
+ else
+ "#{JENKINS_URL}/api/json?depth=1"
+ end
+end
+
def prepare_dashboard
- json = RestClient::Resource.new("#{JENKINS_URL}/api/json?depth=2")
- @projects = Project.parse_incoming_json(JSON.parse(json.get))
+ url = build_jenkins_url
+ client = RestClient::Resource.new(url)
+ response = JSON.parse(client.get)
+ @projects = Project.parse_incoming_json(response)
erb :index
end

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 05:42 (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248759
Default Alt Text
D2833.diff (971 B)

Event Timeline