Merge lp:~cjohnston/qa-dashboard/store-artifacts into lp:qa-dashboard

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 575
Merged at revision: 575
Proposed branch: lp:~cjohnston/qa-dashboard/store-artifacts
Merge into: lp:qa-dashboard
Diff against target: 199 lines (+131/-1)
5 files modified
common/admin.py (+8/-0)
common/management/__init__.py (+4/-0)
common/migrations/0006_add_artifacts.py (+82/-0)
common/models.py (+11/-0)
smokeng/management/commands/jenkins_pull_smokeng.py (+26/-1)
To merge this branch: bzr merge lp:~cjohnston/qa-dashboard/store-artifacts
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+180432@code.launchpad.net

Commit message

Creates 'artifacts' in the dashboard; pulls artifacts from smokeng jobs

Description of the change

There are an increasing number of requests that are being made for the dashboard which all point to the dashboard replacing Jenkins as the viewable front end for QA testing. Many of these requests require that the dashboard produce some sort of data or result based upon the artifacts from a job. In order to satisfy these requests more easily, it would be a good idea to give the dashboard the notion of artifacts.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:575
http://s-jenkins:8080/job/dashboard-ci/154/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins:8080/job/dashboard-ci/154/rebuild

review: Approve (continuous-integration)
575. By Chris Johnston

Add common.artifacts, start saving smokeng artifacts

Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/admin.py'
2--- common/admin.py 2013-08-09 03:20:35 +0000
3+++ common/admin.py 2013-08-15 21:24:23 +0000
4@@ -17,6 +17,7 @@
5 Bug,
6 JenkinsJob,
7 JenkinsBuild,
8+ Artifact,
9 )
10
11 from django.contrib import admin
12@@ -50,6 +51,13 @@
13 ]
14 date_hierarchy = 'ran_at'
15
16+
17+class ArtifactAdmin(admin.ModelAdmin):
18+ list_display = ('name', 'jenkins_build', 'publish')
19+ search_fields = ['name', 'jenkins_build']
20+
21+
22 admin.site.register(Bug, BugAdmin)
23 admin.site.register(JenkinsJob, JenkinsJobAdmin)
24 admin.site.register(JenkinsBuild, JenkinsBuildAdmin)
25+admin.site.register(Artifact, ArtifactAdmin)
26
27=== modified file 'common/management/__init__.py'
28--- common/management/__init__.py 2013-08-02 18:56:36 +0000
29+++ common/management/__init__.py 2013-08-15 21:24:23 +0000
30@@ -327,6 +327,9 @@
31 def _process_logs(self, build, build_date, install_data, func):
32 raise NotImplementedError
33
34+ def process_artifacts(self, build, install_data):
35+ pass
36+
37 def add_result(self):
38 pass
39
40@@ -615,6 +618,7 @@
41 if self.install_data['process_build']:
42 self.add_job_bugs(build)
43 self.process_build(build)
44+ self.process_artifacts(build, self.install_data)
45 self.process_add_result(build)
46 self.post_process_build(build)
47
48
49=== added file 'common/migrations/0006_add_artifacts.py'
50--- common/migrations/0006_add_artifacts.py 1970-01-01 00:00:00 +0000
51+++ common/migrations/0006_add_artifacts.py 2013-08-15 21:24:23 +0000
52@@ -0,0 +1,82 @@
53+# -*- coding: utf-8 -*-
54+import datetime
55+from south.db import db
56+from south.v2 import SchemaMigration
57+from django.db import models
58+
59+
60+class Migration(SchemaMigration):
61+
62+ def forwards(self, orm):
63+ # Adding model 'Artifact'
64+ db.create_table('common_artifacts', (
65+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
66+ ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
67+ ('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
68+ ('internal', self.gf('django.db.models.fields.BooleanField')(default=True)),
69+ ('publish', self.gf('django.db.models.fields.BooleanField')(default=True)),
70+ ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
71+ ('name', self.gf('django.db.models.fields.CharField')(max_length=4096)),
72+ ('jenkins_build', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['common.JenkinsBuild'])),
73+ ))
74+ db.send_create_signal('common', ['Artifact'])
75+
76+
77+ def backwards(self, orm):
78+ # Deleting model 'Artifact'
79+ db.delete_table('common_artifacts')
80+
81+
82+ models = {
83+ 'common.artifact': {
84+ 'Meta': {'object_name': 'Artifact', 'db_table': "'common_artifacts'"},
85+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
86+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
87+ 'internal': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
88+ 'jenkins_build': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['common.JenkinsBuild']"}),
89+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
90+ 'publish': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
91+ 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
92+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
93+ },
94+ 'common.bug': {
95+ 'Meta': {'object_name': 'Bug', 'db_table': "'bugs'"},
96+ 'assignee': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
97+ 'bug_no': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
98+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
99+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
100+ 'importance': ('django.db.models.fields.CharField', [], {'default': "u'unknown'", 'max_length': '4096'}),
101+ 'internal': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
102+ 'project': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
103+ 'publish': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
104+ 'status': ('django.db.models.fields.CharField', [], {'default': "u'unknown'", 'max_length': '4096'}),
105+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
106+ 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
107+ },
108+ 'common.jenkinsbuild': {
109+ 'Meta': {'unique_together': "(('job', 'build_number'),)", 'object_name': 'JenkinsBuild', 'db_table': "'jenkins_builds'"},
110+ 'bugs': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'build_bugs'", 'symmetrical': 'False', 'to': "orm['common.Bug']"}),
111+ 'build_description': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}),
112+ 'build_number': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
113+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
114+ 'failed': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
115+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116+ 'internal': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
117+ 'job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['common.JenkinsJob']"}),
118+ 'publish': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
119+ 'ran_at': ('django.db.models.fields.DateTimeField', [], {}),
120+ 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
121+ },
122+ 'common.jenkinsjob': {
123+ 'Meta': {'object_name': 'JenkinsJob', 'db_table': "'jenkins_jobs'"},
124+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
125+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
126+ 'internal': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
127+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
128+ 'publish': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
129+ 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
130+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
131+ }
132+ }
133+
134+ complete_apps = ['common']
135\ No newline at end of file
136
137=== modified file 'common/models.py'
138--- common/models.py 2013-07-02 21:04:09 +0000
139+++ common/models.py 2013-08-15 21:24:23 +0000
140@@ -150,3 +150,14 @@
141 """ Get number of bugs for this build. """
142
143 return self.bugs.count()
144+
145+
146+class Artifact(DashboardBaseModel):
147+ """ Add artifacts """
148+
149+ class Meta:
150+ db_table = "common_artifacts"
151+
152+ url = models.URLField()
153+ name = models.CharField(max_length=4096)
154+ jenkins_build = models.ForeignKey(JenkinsBuild)
155
156=== modified file 'smokeng/management/commands/jenkins_pull_smokeng.py'
157--- smokeng/management/commands/jenkins_pull_smokeng.py 2013-08-07 19:05:49 +0000
158+++ smokeng/management/commands/jenkins_pull_smokeng.py 2013-08-15 21:24:23 +0000
159@@ -25,7 +25,7 @@
160
161 from common.utah_parser import UTAHParser, ParserError
162 from common.utils import regexes
163-from common.models import Bug
164+from common.models import Bug, Artifact
165
166 from smokeng.models import (
167 SmokeImage,
168@@ -107,6 +107,31 @@
169 total=total_count,
170 )
171
172+ def process_artifacts(self, build, install_data):
173+ artifact_regex = re.compile(
174+ ur'^(clientlogs\/|)(.*.yaml|.*.log$|media-info|.*.props|.*.crash)'
175+ )
176+ for artifact in build['artifacts']:
177+ path = artifact['relativePath']
178+ if artifact_regex.match(path):
179+ logfile_path = "{}{}/artifact/{}".format(
180+ self.install_data['jenkins_build'].job.url,
181+ self.install_data['jenkins_build'].build_number,
182+ artifact['relativePath'],
183+ )
184+ artifact, new_artifact = Artifact.objects.get_or_create(
185+ url=logfile_path,
186+ name=artifact['fileName'],
187+ jenkins_build=install_data['jenkins_build'],
188+ )
189+
190+ if new_artifact:
191+ logging.info(
192+ "Adding %s for jenkins build %s",
193+ artifact['fileName'],
194+ install_data['jenkins_build'],
195+ )
196+
197 def _process_logs(self, build, build_date, install_data, func):
198
199 if not hasattr(func, '__call__'):

Subscribers

People subscribed via source and target branches