Skip to content

Commit

Permalink
Fix build URL in cross reference
Browse files Browse the repository at this point in the history
Correctly fetch the builder id
  • Loading branch information
vladbogo committed Oct 4, 2023
1 parent 3205f0d commit c7c58ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
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.name if builder else None

class Meta:
managed = False
db_table = 'test_run'
Expand Down
2 changes: 1 addition & 1 deletion cross-reference/crossreference/cr/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class MariaDBRouter:
"""

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

0 comments on commit c7c58ab

Please sign in to comment.