Merge lp:~stevanr/linaro-ci-dashboard/poll_jenkins into lp:linaro-ci-dashboard
Proposed by
Stevan Radaković
Status: | Merged |
---|---|
Approved by: | Stevan Radaković |
Approved revision: | 48 |
Merged at revision: | 44 |
Proposed branch: | lp:~stevanr/linaro-ci-dashboard/poll_jenkins |
Merge into: | lp:linaro-ci-dashboard |
Diff against target: |
241 lines (+156/-18) 6 files modified
README (+3/-0) dashboard/frontend/models/loop_build.py (+13/-6) dashboard/jenkinsserver/management/commands/jenkins_build_sync.py (+30/-0) dashboard/jenkinsserver/models/jenkins_server.py (+19/-12) dashboard/jenkinsserver/tests/test_custom_commands.py (+33/-0) dashboard/lib/jenkins_dashboard.py (+58/-0) |
To merge this branch: | bzr merge lp:~stevanr/linaro-ci-dashboard/poll_jenkins |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Milo Casagrande (community) | Needs Fixing | ||
Linaro Infrastructure | Pending | ||
Данило Шеган | Pending | ||
Review via email: mp+123599@code.launchpad.net |
Description of the change
Add a jenkins server custom command to sync the unfinished builds to frontend.
We should now have a ready command to put it in the cronjob, and can quite easy implement command to do periodic sync from jenkins. This other proposal should be discussed and maybe implemented in this MP.
To post a comment you must log in.
=== modified file 'dashboard/ frontend/ models/ loop_build. py' frontend/ models/ loop_build. py 2012-09-10 12:25:33 +0000 frontend/ models/ loop_build. py 2012-09-10 17:16:19 +0000
('aborted' , 'ABORTED'), STATUSES = ["failure", "success"] STATUSES = ["scheduled", "running"]
--- dashboard/
+++ dashboard/
@@ -34,6 +34,7 @@
)
FINISHED_
+ NON_FINISHED_
I was thinking about defining single variables for each status, and then use that instead of writing the "real" value each time:
FAILURE = 'failure'
...
FINISHED_STATUSES = [FAILURE, ...]
@@ -73,14 +71,23 @@
# update the build info in CI.
if build.remote_number and \
jenkins_ build[" number" ] == build.remote_ number: Request( jenkins_ build[" url"] + urlopen( request) .read() response) dict["result" ] dict["duration" ] build_info( ) info(self, build): get_build_ info(build. loop.name, number) build[" duration" ]) / 1000 build[" result" ].lower( )
-
- request = urllib2.
- "api/json")
- response = urllib2.
- response_dict = json.loads(
- build.status = response_
- build.duration = response_
- build.save()
+ self.get_
+
+ def get_build_
+ jenkins_build = self.jenkins.
+ build.remote_
+ # Duration in jenkins is presented in milliseconds
+ build.duration = float(jenkins_
+ build.status = jenkins_
+ # TODO: Add build result xml, but from where?
This is a good point to discuss: the build.result_xml is probably different from the XML we want to store here, since it is coming from Jenkins and that will hold results valid or for another build, or valid by themselves for this build. If they are different, probably it makes sense to store the XML in a different field of the model (jenkins_xml), maybe using the same XML structure or extending our XML DTD, or we can update the XML we already have with Jenkins information. But with the latter I would say to extend the DTD and have a specific jenkins element in there to retrieve the necessary values in one shot.
=== added file 'dashboard/ lib/jenkins_ dashboard. py' lib/jenkins_ dashboard. py 1970-01-01 00:00:00 +0000 lib/jenkins_ dashboard. py 2012-09-10 17:16:19 +0000 ci-dashboard.
--- dashboard/
+++ dashboard/
@@ -0,0 +1,56 @@
+# Copyright (C) 2012 Linaro
+#
+# This file is part of linaro-
+#
+# linaro-ci-dashboard is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# linaro-ci-dashboard is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public Li...