Skip to content

Auto-tune workflow step timeouts based on historical CI performance #23043

@nirs

Description

@nirs

Summary

Create a weekly GitHub Actions workflow that automatically adjusts per-step timeout-minutes values in all CI workflow files based on recent performance data.

Background

The workflow-stats tool (#23042) analyzes GitHub Actions step durations and suggests timeouts based on P95 x 3, rounded up to the nearest minute (minimum 1 minute). Currently this is a manual process - run the tool, review the output, update the YAML files.

Example output:

$ workflow-stats -workflow "Functional Test" -since 30

Step                                                N     Min     Avg     P95     Max  Timeout
Run Functional Test                               728   2m50s   4m05s   5m21s   9m27s   17m00s
Build minikube and e2e test binaries              156   1m07s   1m39s   2m09s   2m16s    7m00s
Set up Rootless Docker (rootless)                  67     42s     48s     56s   1m21s    3m00s
...

Proposal

Add a scheduled workflow that:

  1. Runs workflow-stats -o json -since 30 for each CI workflow
  2. Parses the suggested timeouts per step from the JSON output
  3. Matches step names to their definitions in .github/workflows/*.yml
  4. Updates timeout-minutes values where they differ from the suggestion
  5. Opens a PR if any changes were made

Considerations

  • YAML parsing must preserve comments and formatting
  • Step name matching between tool output and workflow YAML needs to handle truncation and special characters
  • Matrix jobs share step definitions across variants with different performance profiles - use the worst-case (max across variants) timeout
  • The PR should include a summary of what changed and why
  • Should run weekly (e.g., Sunday night) to avoid noisy PRs

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions