Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3747952
D2833.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
971 B
Referenced Files
None
Subscribers
None
D2833.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D2833: Allow Tommy to cope with depth=2 timeout
Attached
Detach File
Event Timeline
Log In to Comment