Skip to content

Commit

Permalink
introduce aggregated build status on release & start using it
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Mar 10, 2024
1 parent c10a90e commit f778f90
Show file tree
Hide file tree
Showing 15 changed files with 273 additions and 199 deletions.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions migrations/20240309082057_release_status_view.sql.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP VIEW release_build_status;
22 changes: 22 additions & 0 deletions migrations/20240309082057_release_status_view.sql.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE OR REPLACE VIEW release_build_status AS (
SELECT
summary.id,
summary.last_build_time,
CASE
WHEN summary.success_count > 0 THEN 'success'::build_status
WHEN summary.failure_count > 0 THEN 'failure'::build_status
ELSE 'in_progress'::build_status
END as build_status

FROM (
SELECT
r.id,
MAX(b.build_time) as last_build_time,
SUM(CASE WHEN b.build_status = 'success' THEN 1 ELSE 0 END) as success_count,
SUM(CASE WHEN b.build_status = 'failure' THEN 1 ELSE 0 END) as failure_count
FROM
releases as r
LEFT OUTER JOIN builds AS b on b.rid = r.id
GROUP BY r.id
) as summary
);
Loading

0 comments on commit f778f90

Please sign in to comment.