Skip to content

Add a weekly CI digest - #2365

Open
whi-tw wants to merge 1 commit into
mainfrom
ci-digest
Open

whi-tw wants to merge 1 commit into
mainfrom
ci-digest

Conversation

@whi-tw

@whi-tw whi-tw commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/jPeqHHPu/772-improve-the-observability-of-our-github-workflows

There is no view of how often CI fails or slows down over time. This adds a weekly "CI digest" for each forms repo: how often its workflows failed in the last week compared with the previous 12 weeks, which jobs and specs failed, and how long runs take. The logic is in support/ci-digest and is called through reusable-ci-digest.yml. Each repo has a small scheduled workflow that calls it, and the other forms repos have matching PRs.

It is a dry run for now. Each run writes the digest to its job summary, and nothing is posted to Slack until we have seen a few weeks of output. To go live, change the default of dry_run to false in reusable-ci-digest.yml; every repo then posts to #govuk-forms-deployment-notifications on its next run. Only scheduled and manually started runs can post, so a pull request run is always a dry run.

This is the second layer of a stack: #2332 (timeouts and the lint for them) is below it and #2378 (tests) above it. Review and merge in that order.

A failed run on main or in the merge queue does not stop AWS deploying it, so failures are easy to miss. A weekly digest shows the trend without an alert for every failed run.

The script only reads GitHub's API, and support/ci-digest/README.md explains how to read a digest and run one locally. A pull request that changes the digest runs it on the pull request, using its own version of the script. The tests are in #2378, stacked on this PR.

GitHub lists a workflow run once, as its last attempt, so a run that failed and then passed when re-run would look like a success. The script reads the earlier attempts of re-run runs too and counts each as a run of its own, so flaky runs show up as failures. That costs one extra API call per earlier attempt, and the script stops without a digest if one cannot be read.

Before merging

  • After merge, run "CI digest" from the Actions tab and check the digest in the job summary (it can only be run once the file is on main)
  • Set timeouts on workflow jobs and lint for them #2332 merged
  • The matching PRs in forms-admin, forms-runner, forms-product-page and forms-e2e-tests call this workflow at @main, so merge this one before them.

Before going live

  • An org-level SLACK_WEBHOOK_GOVUK_FORMS_DEPLOYMENTS secret exists and is available to the forms-* repos.
  • A few weeks of digests have been read and the thresholds look right.

Things to consider when reviewing

  • Is the digest useful? Run GH_REPO=govuk-forms/forms-deploy support/ci-digest/ci-digest.sh to see one.
  • Are the thresholds (three failures and double the usual rate for a warning, 25% and 30 seconds for run times) sensible?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the weekly CI digest changes.

No open issues 🎉

What changed in this PR

Adds a reusable weekly CI digest for the Forms repositories, comparing recent workflow failures and run times with the previous 12 weeks. Digests initially appear only in job summaries, with Slack posting disabled.

Changes:

  • Collects workflow history, calculates failure rates and timing trends, and summarises failed jobs and RSpec examples.
  • Adds scheduled, manual and pull-request execution through a shared workflow.
  • Adds fixture-based tests to Shell script CI and documents local use and Slack rollout.
File Description
support/​ci-digest/​testdata/​runs.json Supplies workflow histories and edge cases for tests.
support/​ci-digest/​testdata/​expected.txt Defines expected failure-rate and timing output.
support/​ci-digest/​testdata/​expected-with-reasons.txt Defines expected failure explanations and run links.
support/​ci-digest/​README.md Documents interpretation, local use and rollout.
support/​ci-digest/​ci-digest.test.sh Checks report output, API failures and query splitting.
support/​ci-digest/​ci-digest.sh Fetches workflow history and collects failure details.
support/​ci-digest/​ci-digest.jq Calculates comparisons and formats the digest.
.github/​workflows/​shell-ci.yml Runs digest tests in existing shell CI.
.github/​workflows/​reusable-ci-digest.yml Generates job summaries and gates optional Slack posting.
.github/​workflows/​ci-digest.yml Adds weekly, manual and digest-related PR triggers.

Review effort: Balanced

@whi-tw
whi-tw added this pull request to stack #2367 October 29, 2026 14:45
@whi-tw
whi-tw removed this pull request from stack #2367 October 29, 2026 14:46
Copilot AI balanced review requested due to automatic review settings October 29, 2026 14:48
@whi-tw
whi-tw changed the base branch from main to observe-workflow-failures October 29, 2026 14:48
@whi-tw
whi-tw added this pull request to stack #2368 October 29, 2026 14:48
@github-actions

Copy link
Copy Markdown

Warning

You are changing the Terraform version.

Before you merge this PR, you must apply the forms/pipelines
Terraform root from this branch in each of the forms environments.

make ENV forms/pipelines apply

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active issues can omit retries from weekly failure counts and reasons when they cross the reporting cutoff, while failure links can open a later successful attempt instead of the failed attempt.

2 open issues

Review effort: Balanced

Comment thread support/ci-digest/ci-digest.jq Resolved
Comment thread support/ci-digest/ci-digest.sh Resolved
Copilot AI balanced review requested due to automatic review settings October 29, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The failure link uses an unpinned run URL, so a later successful retry can make it open a different attempt than the failure reported in the digest.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread support/ci-digest/ci-digest.sh Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Earlier re-run attempts with a null workflow name bypass the fallback and cause gsub to fail, aborting the entire digest; the fallback and fixture coverage need to include re-runs.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread support/ci-digest/ci-digest.sh Resolved
Copilot AI balanced review requested due to automatic review settings October 29, 2026 15:30
Copilot AI balanced review requested due to automatic review settings November 3, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the weekly CI digest changes.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documented fixture-backed tests are missing and shell CI runs only lint checks, leaving digest calculations without the claimed validation.

1 open issue

Review effort: Balanced

Comment thread support/ci-digest/README.md Resolved
Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The documented test runner and fixtures are missing, leaving the advertised command unusable and digest calculations untested by CI, which only runs ShellCheck.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The weekly CI digest changes have no active review issues requiring resolution.

1 open issue

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the shared weekly CI digest changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

We have no view of how often CI fails or slows down over time, and a
failed run on main does not stop AWS deploying it. A weekly summary
compared with the previous 12 weeks shows the trend without an alert for
every failed run.

It runs as a dry run for now: the digest goes to the job summary and
nothing is posted to Slack until we have seen a few weeks of output.
Pull requests that change the digest run it too, with their own version
of the script, so changes are tried out before they are merged. Those
runs never post to Slack, even once it is live.

GitHub lists a workflow run once, as its last attempt, so a run that
failed and then passed when re-run would look like a success. The
script reads the earlier attempts of re-run runs too and counts each as
a run of its own, so flaky runs show up as failures.

The logic lives here so each forms repo can call it from a thin
scheduled workflow.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants