From: Michael Tremer Date: Fri, 12 May 2023 21:30:31 +0000 (+0000) Subject: events: Log when test builds fail/succeed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202aff1e3223f3d2cddeba0dc739ead5befa9792;p=pbs.git events: Log when test builds fail/succeed Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/events.py b/src/buildservice/events.py index 2e37543a..cdc42715 100644 --- a/src/buildservice/events.py +++ b/src/buildservice/events.py @@ -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, diff --git a/src/templates/events/modules/system-message.html b/src/templates/events/modules/system-message.html index cc72a7a5..67ab84c8 100644 --- a/src/templates/events/modules/system-message.html +++ b/src/templates/events/modules/system-message.html @@ -33,6 +33,14 @@

+ {% elif event.type == "test-builds-succeeded" %} +

+ +

+ {% elif event.type == "test-builds-failed" %} +

+ +

{% else %}

@@ -66,6 +74,10 @@ {% 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" %}