Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build URL in cross reference #186

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cross-reference/crossreference/cr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
from django.db import connection
from datetime import datetime

class Builder(models.Model):
id = models.IntegerField(primary_key=True)
name = models.TextField()
description = models.TextField(null=True, blank=True)
name_hash = models.CharField(max_length=40, unique=True)

class Meta:
managed = False
db_table = 'builders'

class TestRun(models.Model):
branch = models.CharField(max_length=100, blank=True, null=True)
revision = models.CharField(max_length=256, blank=True, null=True)
Expand All @@ -14,6 +24,11 @@ class TestRun(models.Model):
typ = models.CharField(max_length=32)
info = models.CharField(max_length=255, blank=True, null=True)

@property
def platform_name(self):
builder = Builder.objects.filter(name=self.platform).first()
return builder.id if builder else None

class Meta:
managed = False
db_table = 'test_run'
Expand Down
4 changes: 2 additions & 2 deletions cross-reference/crossreference/cr/router.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from .models import TestRun, TestFailure
from .models import TestRun, TestFailure, Builder

class MariaDBRouter:
"""
Database router directing TestRun and TestFailure models to MariaDB.
"""

def db_for_read(self, model, **hints):
if model in [TestRun, TestFailure]:
if model in [TestRun, TestFailure, Builder]:
return 'mariadb'
return 'default'

Expand Down
2 changes: 1 addition & 1 deletion cross-reference/crossreference/cr/templates/cr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h2 style="color: #4e629a;">Results</h2>
</thead>
{% for test in test_runs %}
<tr class="expandable">
<td> [<a href="https://buildbot.mariadb.org/#/builders/{{ test.test_run_id.revision }}/builds/{{ test.test_run_id.bbnum }}" > Build details </a>] </td>
<td> [<a href="https://buildbot.mariadb.org/#/builders/{{ test.test_run_id.platform_name }}/builds/{{ test.test_run_id.bbnum }}" > Build details </a>] </td>
<td>{{test.test_run_id.branch}}</td>
<td>{{test.test_run_id.revision| slice:9}}</td>
<td>{{test.platform}}</td>
Expand Down