Skip to content

Commit aabfae0

Browse files
committed
CFbot integration
This adds our own custom replication between the CFbot and the commitfest app. We currently keep the last CFbot runs in our database, in an attempt to keep the queries easy and efficient. The CFbot results are now shown on the overview page of each commitfest, as well as on the page for each specific patch.
1 parent 63faa7d commit aabfae0

File tree

14 files changed

+299
-4
lines changed

14 files changed

+299
-4
lines changed
Lines changed: 4 additions & 0 deletions
Loading

media/commitfest/new_failure.svg

Lines changed: 5 additions & 0 deletions
Loading

media/commitfest/new_success.svg

Lines changed: 4 additions & 0 deletions
Loading

media/commitfest/old_failure.svg

Lines changed: 5 additions & 0 deletions
Loading

media/commitfest/old_success.svg

Lines changed: 4 additions & 0 deletions
Loading

media/commitfest/running.svg

Lines changed: 4 additions & 0 deletions
Loading

media/commitfest/waiting_to_start.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Generated by Django 3.2.25 on 2024-10-31 22:53
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('commitfest', '0005_history_dateindex'),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='CfbotBranch',
16+
fields=[
17+
('patch', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='cfbot_branch', serialize=False, to='commitfest.patch')),
18+
('branch_id', models.IntegerField()),
19+
('branch_name', models.TextField()),
20+
('commit_id', models.TextField(blank=True, null=True)),
21+
('apply_url', models.TextField()),
22+
('status', models.TextField(choices=[('testing', 'Testing'), ('finished', 'Finished'), ('failed', 'Failed'), ('timeout', 'Timeout')])),
23+
('created', models.DateTimeField(auto_now_add=True)),
24+
('modified', models.DateTimeField(auto_now=True)),
25+
],
26+
),
27+
migrations.CreateModel(
28+
name='CfbotTask',
29+
fields=[
30+
('id', models.TextField(primary_key=True, serialize=False)),
31+
('task_name', models.TextField()),
32+
('branch_id', models.IntegerField()),
33+
('position', models.IntegerField()),
34+
('status', models.TextField(choices=[('CREATED', 'Created'), ('NEEDS_APPROVAL', 'Needs Approval'), ('TRIGGERED', 'Triggered'), ('EXECUTING', 'Executing'), ('FAILED', 'Failed'), ('COMPLETED', 'Completed'), ('ABORTED', 'Aborted'), ('ERRORED', 'Errored')])),
35+
('created', models.DateTimeField(auto_now_add=True)),
36+
('modified', models.DateTimeField(auto_now=True)),
37+
('patch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cfbot_tasks', to='commitfest.patch')),
38+
],
39+
),
40+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.25 on 2024-12-06 08:38
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('commitfest', '0006_cfbot_integration'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='cfbottask',
15+
name='status',
16+
field=models.TextField(choices=[('CREATED', 'Created'), ('NEEDS_APPROVAL', 'Needs Approval'), ('TRIGGERED', 'Triggered'), ('EXECUTING', 'Executing'), ('FAILED', 'Failed'), ('COMPLETED', 'Completed'), ('SCHEDULED', 'Scheduled'), ('ABORTED', 'Aborted'), ('ERRORED', 'Errored')]),
17+
),
18+
]

pgcommitfest/commitfest/models.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,43 @@ class PatchStatus(models.Model):
341341
class PendingNotification(models.Model):
342342
history = models.ForeignKey(PatchHistory, blank=False, null=False, on_delete=models.CASCADE)
343343
user = models.ForeignKey(User, blank=False, null=False, on_delete=models.CASCADE)
344+
345+
346+
class CfbotBranch(models.Model):
347+
STATUS_CHOICES = [
348+
('testing', 'Testing'),
349+
('finished', 'Finished'),
350+
('failed', 'Failed'),
351+
('timeout', 'Timeout'),
352+
]
353+
354+
patch = models.OneToOneField(Patch, on_delete=models.CASCADE, related_name="cfbot_branch", primary_key=True)
355+
branch_id = models.IntegerField(null=False)
356+
branch_name = models.TextField(null=False)
357+
commit_id = models.TextField(null=True, blank=True)
358+
apply_url = models.TextField(null=False)
359+
status = models.TextField(choices=STATUS_CHOICES, null=False)
360+
created = models.DateTimeField(auto_now_add=True)
361+
modified = models.DateTimeField(auto_now=True)
362+
363+
class CfbotTask(models.Model):
364+
STATUS_CHOICES = [
365+
('CREATED', 'Created'),
366+
('NEEDS_APPROVAL', 'Needs Approval'),
367+
('TRIGGERED', 'Triggered'),
368+
('EXECUTING', 'Executing'),
369+
('FAILED', 'Failed'),
370+
('COMPLETED', 'Completed'),
371+
('SCHEDULED', 'Scheduled'),
372+
('ABORTED', 'Aborted'),
373+
('ERRORED', 'Errored'),
374+
]
375+
376+
id = models.TextField(primary_key=True)
377+
task_name = models.TextField(null=False)
378+
patch = models.ForeignKey(Patch, on_delete=models.CASCADE, related_name="cfbot_tasks")
379+
branch_id = models.IntegerField(null=False)
380+
position = models.IntegerField(null=False)
381+
status = models.TextField(choices=STATUS_CHOICES, null=False)
382+
created = models.DateTimeField(auto_now_add=True)
383+
modified = models.DateTimeField(auto_now=True)

0 commit comments

Comments
 (0)