]> git.ipfire.org Git - pbs.git/commitdiff
events: Log when test builds fail/succeed
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 May 2023 21:30:31 +0000 (21:30 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 May 2023 21:30:31 +0000 (21:30 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/events.py
src/templates/events/modules/system-message.html

index 2e37543aaf6f0cb11570541cc9cb30a5669f37f3..cdc42715e6aa9fbd9551ee36516fc5c8cbf1be13 100644 (file)
@@ -41,6 +41,7 @@ log = logging.getLogger("pbs.events")
 # build
 # by_build
 # build_comment
+# build_group
 # job
 # user
 # by_user
@@ -58,6 +59,7 @@ EVENTS_VIEW = """
                        builds.id AS build,
                        NULL::integer AS by_build,
                        NULL::integer AS build_comment,
+                       NULL::integer AS build_group,
                        NULL::integer AS job,
                        NULL::integer AS user,
                        builds.owner_id AS by_user,
@@ -85,6 +87,7 @@ EVENTS_VIEW = """
                        builds.id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -106,6 +109,7 @@ EVENTS_VIEW = """
                        builds.id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        builds.deleted_by AS by_user,
@@ -128,6 +132,7 @@ EVENTS_VIEW = """
                        builds.id AS build,
                        builds.deprecating_build_id AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        builds.deprecated_by AS by_user,
@@ -151,6 +156,7 @@ EVENTS_VIEW = """
                        build_comments.build_id AS build,
                        NULL AS by_build,
                        build_comments.id AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        build_comments.user_id AS by_user,
@@ -172,6 +178,7 @@ EVENTS_VIEW = """
                        build_watchers.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        build_watchers.user_id AS user,
                        NULL AS by_user,
@@ -191,6 +198,7 @@ EVENTS_VIEW = """
                        build_watchers.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        build_watchers.user_id AS user,
                        NULL AS by_user,
@@ -212,6 +220,7 @@ EVENTS_VIEW = """
                        repository_builds.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        repository_builds.added_by AS by_user,
@@ -231,6 +240,7 @@ EVENTS_VIEW = """
                        repository_builds.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        repository_builds.removed_by AS by_user,
@@ -244,7 +254,7 @@ EVENTS_VIEW = """
 
                UNION ALL
 
-               -- Build Scores
+               -- Build Points
 
                SELECT
                        'build-points' AS type,
@@ -253,6 +263,7 @@ EVENTS_VIEW = """
                        build_points.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        NULL AS job,
                        NULL AS user,
                        build_points.user_id AS by_user,
@@ -264,6 +275,35 @@ EVENTS_VIEW = """
 
                UNION ALL
 
+               -- Test Builds
+               SELECT
+                       CASE WHEN build_groups.failed IS TRUE THEN 'test-builds-failed'
+                               ELSE 'test-builds-succeeded' END AS type,
+                       build_groups.finished_at AS t,
+                       4 AS priority,
+                       builds.id AS build,
+                       NULL AS by_build,
+                       NULL AS build_comment,
+                       build_groups.id AS build_group,
+                       NULL AS job,
+                       NULL AS user,
+                       NULL AS by_user,
+                       NULL AS builder,
+                       NULL AS repository,
+                       NULL AS points
+               FROM
+                       builds
+               JOIN
+                       build_groups ON builds.test_group_id = build_groups.id
+               WHERE
+                       builds.deleted_at IS NULL
+               AND
+                       build_groups.deleted_at IS NULL
+               AND
+                       build_groups.finished_at IS NOT NULL
+
+               UNION ALL
+
                -- Jobs Creations
                SELECT
                        'job-created' AS type,
@@ -272,6 +312,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -293,6 +334,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -320,6 +362,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -347,6 +390,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        jobs.aborted_by AS by_user,
@@ -370,6 +414,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -393,6 +438,7 @@ EVENTS_VIEW = """
                        jobs.build_id AS build,
                        NULL AS by_build,
                        NULL AS build_comment,
+                       NULL AS build_group,
                        jobs.id AS job,
                        NULL AS user,
                        NULL AS by_user,
@@ -419,6 +465,9 @@ class Events(base.Object):
                        # Build Comments
                        "build_comment" : self.backend.builds.comments.get_by_id,
 
+                       # Build Groups
+                       "build_group"   : self.backend.builds.groups.get_by_id,
+
                        # Jobs
                        "job"           : self.backend.jobs.get_by_id,
 
index cc72a7a5f0e86fc9c6e7736fa95f09a6757f185e..67ab84c8fcf546c0e3824b4768f052b96cc629e7 100644 (file)
                                <p class="icon is-large has-text-danger">
                                        <i class="fa-solid fa-2x fa-thumbs-down"></i>
                                </p>
+                       {% elif event.type == "test-builds-succeeded" %}
+                               <p class="icon is-large has-text-success">
+                                       <i class="fa-solid fa-2x fa-flask-vial"></i>
+                               </p>
+                       {% elif event.type == "test-builds-failed" %}
+                               <p class="icon is-large has-text-danger">
+                                       <i class="fa-solid fa-2x fa-flask-vial"></i>
+                               </p>
                        {% else %}
                                <p class="icon is-large has-text-light">
                                        <i class="fa-solid fa-2x fa-question"></i>
                                        {% elif event.points < 0 %}
                                                {{ _("This build has lost one point", "This build has lost %(points)s points", -event.points) % { "points" : -event.points } }}
                                        {% end %}
+                               {% elif event.type == "test-builds-succeeded" %}
+                                       {{ _("All Test Builds Succeeded") }}
+                               {% elif event.type == "test-builds-failed" %}
+                                       {{ _("Test Builds Failed") }}
                                {% elif event.type == "job-created" %}
                                        {{ _("Job Created") }}
                                {% elif event.type == "job-failed" %}