Merge lp:~stevanr/linaro-ci-dashboard/build_results_xml into lp:linaro-ci-dashboard

Proposed by Stevan Radaković
Status: Merged
Merged at revision: 40
Proposed branch: lp:~stevanr/linaro-ci-dashboard/build_results_xml
Merge into: lp:linaro-ci-dashboard
Diff against target: 176 lines (+106/-6)
7 files modified
dashboard/frontend/android_textfield_loop/models/android_textfield_loop.py (+0/-4)
dashboard/frontend/android_textfield_loop/tests/test_android_textfield_loop_model.py (+10/-1)
dashboard/frontend/android_textfield_loop/urls.py (+5/-0)
dashboard/frontend/android_textfield_loop/views/android_textfield_loop_build_view.py (+26/-0)
dashboard/frontend/migrations/0005_auto__add_field_loopbuild_result_xml.py (+51/-0)
dashboard/frontend/models/loop_build.py (+1/-0)
dashboard/frontend/models/textfield_loop.py (+13/-1)
To merge this branch: bzr merge lp:~stevanr/linaro-ci-dashboard/build_results_xml
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Linaro Infrastructure Pending
Review via email: mp+122878@code.launchpad.net

Description of the change

Add result_xml attr to the LoopBuild model.
Add schedule_build override for textfield_loop model.
Also add build view for android text field loop.

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

Hey Stevan, it looks good to go for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dashboard/frontend/android_textfield_loop/models/android_textfield_loop.py'
2--- dashboard/frontend/android_textfield_loop/models/android_textfield_loop.py 2012-09-04 14:29:53 +0000
3+++ dashboard/frontend/android_textfield_loop/models/android_textfield_loop.py 2012-09-05 14:04:21 +0000
4@@ -31,7 +31,3 @@
5 def can_chain_into():
6 chain = [ANDROID_LOOP]
7 return chain
8-
9- def save(self, *args, **kwargs):
10- self.type = self.__class__.__name__
11- super(AndroidTextFieldLoop, self).save(*args, **kwargs)
12
13=== modified file 'dashboard/frontend/android_textfield_loop/tests/test_android_textfield_loop_model.py'
14--- dashboard/frontend/android_textfield_loop/tests/test_android_textfield_loop_model.py 2012-09-03 15:44:47 +0000
15+++ dashboard/frontend/android_textfield_loop/tests/test_android_textfield_loop_model.py 2012-09-05 14:04:21 +0000
16@@ -52,4 +52,13 @@
17 def test_valid_values_wrong(self):
18 self.assertEqual((False, self.NON_VALID_LINES),
19 AndroidTextFieldLoop.valid_values(
20- self.NON_VALID_VALUES))
21\ No newline at end of file
22+ self.NON_VALID_VALUES))
23+
24+ def test_schedule_build(self):
25+ build = self.android_loop.schedule_build()
26+ self.assertEqual(build.result_xml, self.VALID_DICT)
27+ self.assertEqual(build.status, "success")
28+
29+ def test_schedule_build_invalid(self):
30+ build = self.non_valid_android_loop.schedule_build()
31+ self.assertEqual(build.result_xml, {})
32
33=== modified file 'dashboard/frontend/android_textfield_loop/urls.py'
34--- dashboard/frontend/android_textfield_loop/urls.py 2012-08-30 15:46:41 +0000
35+++ dashboard/frontend/android_textfield_loop/urls.py 2012-09-05 14:04:21 +0000
36@@ -22,6 +22,8 @@
37 import AndroidTextFieldLoopUpdateView
38 from frontend.android_textfield_loop.views.android_textfield_loop_detail_view \
39 import AndroidTextFieldLoopDetailView
40+from frontend.android_textfield_loop.views.android_textfield_loop_build_view \
41+ import AndroidTextFieldLoopBuildView
42
43
44 urlpatterns = patterns('',
45@@ -34,4 +36,7 @@
46 url(r'^android-text/update/(?P<slug>[\w|\W]+)/$',
47 AndroidTextFieldLoopUpdateView.as_view(),
48 name='AndroidTextFieldLoopUpdate'),
49+ url(r'^android-text/build/(?P<slug>[\w|\W]+)/$',
50+ AndroidTextFieldLoopBuildView.as_view(),
51+ name='AndroidTextFieldLoopBuild'),
52 )
53
54=== added file 'dashboard/frontend/android_textfield_loop/views/android_textfield_loop_build_view.py'
55--- dashboard/frontend/android_textfield_loop/views/android_textfield_loop_build_view.py 1970-01-01 00:00:00 +0000
56+++ dashboard/frontend/android_textfield_loop/views/android_textfield_loop_build_view.py 2012-09-05 14:04:21 +0000
57@@ -0,0 +1,26 @@
58+#!/usr/bin/env python
59+# Copyright (C) 2012 Linaro
60+#
61+# This file is part of linaro-ci-dashboard.
62+#
63+# linaro-ci-dashboard is free software: you can redistribute it and/or modify
64+# it under the terms of the GNU Affero General Public License as published by
65+# the Free Software Foundation, either version 3 of the License, or
66+# (at your option) any later version.
67+#
68+# linaro-ci-dashboard is distributed in the hope that it will be useful,
69+# but WITHOUT ANY WARRANTY; without even the implied warranty of
70+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71+# GNU Affero General Public License for more details.
72+#
73+# You should have received a copy of the GNU Affero General Public License
74+# along with linaro-ci-dashboard. If not, see <http://www.gnu.org/licenses/>.
75+
76+from frontend.android_textfield_loop.models.android_textfield_loop \
77+ import AndroidTextFieldLoop
78+from frontend.views.loop_build_view import LoopBuildView
79+
80+
81+class AndroidTextFieldLoopBuildView(LoopBuildView):
82+
83+ model = AndroidTextFieldLoop
84
85=== added file 'dashboard/frontend/migrations/0005_auto__add_field_loopbuild_result_xml.py'
86--- dashboard/frontend/migrations/0005_auto__add_field_loopbuild_result_xml.py 1970-01-01 00:00:00 +0000
87+++ dashboard/frontend/migrations/0005_auto__add_field_loopbuild_result_xml.py 2012-09-05 14:04:21 +0000
88@@ -0,0 +1,51 @@
89+# encoding: utf-8
90+import datetime
91+from south.db import db
92+from south.v2 import SchemaMigration
93+from django.db import models
94+
95+class Migration(SchemaMigration):
96+
97+ def forwards(self, orm):
98+
99+ # Adding field 'LoopBuild.result_xml'
100+ db.add_column('frontend_loopbuild', 'result_xml', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)
101+
102+
103+ def backwards(self, orm):
104+
105+ # Deleting field 'LoopBuild.result_xml'
106+ db.delete_column('frontend_loopbuild', 'result_xml')
107+
108+
109+ models = {
110+ 'frontend.loop': {
111+ 'Meta': {'object_name': 'Loop'},
112+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
113+ 'is_official': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
114+ 'is_restricted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
115+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
116+ 'next_loop': ('django.db.models.fields.related.OneToOneField', [], {'blank': 'True', 'related_name': "'previous_loop'", 'unique': 'True', 'null': 'True', 'to': "orm['frontend.Loop']"}),
117+ 'server': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['jenkinsserver.JenkinsServer']", 'null': 'True'}),
118+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '50'})
119+ },
120+ 'frontend.loopbuild': {
121+ 'Meta': {'ordering': "['-id']", 'object_name': 'LoopBuild'},
122+ 'build_number': ('django.db.models.fields.IntegerField', [], {'default': 'None'}),
123+ 'duration': ('django.db.models.fields.DecimalField', [], {'max_digits': '8', 'decimal_places': '2'}),
124+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
125+ 'loop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['frontend.Loop']"}),
126+ 'remote_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
127+ 'result_xml': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
128+ 'status': ('django.db.models.fields.CharField', [], {'max_length': '20'})
129+ },
130+ 'jenkinsserver.jenkinsserver': {
131+ 'Meta': {'object_name': 'JenkinsServer'},
132+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
133+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
134+ 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
135+ 'username': ('django.db.models.fields.CharField', [], {'max_length': '100'})
136+ }
137+ }
138+
139+ complete_apps = ['frontend']
140
141=== modified file 'dashboard/frontend/models/loop_build.py'
142--- dashboard/frontend/models/loop_build.py 2012-07-26 09:12:27 +0000
143+++ dashboard/frontend/models/loop_build.py 2012-09-05 14:04:21 +0000
144@@ -37,6 +37,7 @@
145 remote_number = models.IntegerField(null=True, blank=True)
146 status = models.CharField(max_length=20, choices=BUILD_STATUS)
147 duration = models.DecimalField(max_digits=8, decimal_places=2)
148+ result_xml = models.TextField(null=True, blank=True)
149
150 def save(self, *args, **kwargs):
151 loop_builds = LoopBuild.objects.filter(loop=self.loop).order_by("-id")
152
153=== modified file 'dashboard/frontend/models/textfield_loop.py'
154--- dashboard/frontend/models/textfield_loop.py 2012-09-03 15:44:21 +0000
155+++ dashboard/frontend/models/textfield_loop.py 2012-09-05 14:04:21 +0000
156@@ -40,7 +40,19 @@
157 values = models.TextField()
158
159 def schedule_build(self, parameters=None):
160- return None
161+ from frontend.models.loop_build import LoopBuild
162+ build = LoopBuild()
163+ build.loop = self
164+ build.duration = 0.00
165+
166+ try:
167+ build.result_xml = self.values_to_dict()
168+ build.status = 'success'
169+ except:
170+ build.status = 'failure'
171+
172+ build.save()
173+ return build
174
175 def values_to_dict(self):
176 """

Subscribers

People subscribed via source and target branches