-
Notifications
You must be signed in to change notification settings - Fork 1
feat(renovate): bound fleet maintenance intake #2893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Fleet Renovate preset | ||
|
|
||
| `fleet.json` is the single source of truth for Renovate intake across Workflows and | ||
| the registered consumer repositories. It opens routine dependency work only in the | ||
| Monday 01:00–05:00 America/Chicago maintenance window, permits at most three routine | ||
| branches and PRs, and limits commits to two per hour. | ||
|
|
||
| Routine releases must be at least three days old and wait until their update-branch | ||
| checks are not pending. Vulnerability alerts bypass the window, release-age delay, | ||
| and update-branch check gate so security remediation is never held by the routine | ||
| budget. | ||
|
|
||
| Trusted GitHub Actions digest, pin, minor, and patch updates share one green-automerge | ||
| lane. Major updates remain visible in the Dependency Dashboard and create a PR only | ||
| after an explicit dashboard approval. Lock-file maintenance is a separate, grouped | ||
| weekly lane in the same window. | ||
|
|
||
| Validate the repository config before review: | ||
|
|
||
| ```bash | ||
| npx --yes --package renovate@43.285.3 -- renovate-config-validator --no-global \ | ||
| renovate.json renovate-presets/fleet.json \ | ||
| templates/consumer-repo/.github/renovate.json | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import json | ||
| from pathlib import Path | ||
|
|
||
| PRESET_PATH = Path(__file__).resolve().parents[2] / "renovate-presets" / "fleet.json" | ||
| REPO_ROOT = PRESET_PATH.parents[1] | ||
|
|
||
|
|
||
| def _preset() -> dict: | ||
| return json.loads(PRESET_PATH.read_text(encoding="utf-8")) | ||
|
|
||
|
|
||
| def _rule(preset: dict, **expected: object) -> dict: | ||
| matches = [ | ||
| rule | ||
| for rule in preset["packageRules"] | ||
| if all(rule.get(key) == value for key, value in expected.items()) | ||
| ] | ||
| assert len(matches) == 1 | ||
| return matches[0] | ||
|
|
||
|
|
||
| def test_fleet_renovate_intake_budget_is_bounded_to_the_weekly_window() -> None: | ||
| preset = _preset() | ||
|
|
||
| assert preset["timezone"] == "America/Chicago" | ||
| assert preset["schedule"] == ["after 1am and before 5am on monday"] | ||
| assert preset["commitHourlyLimit"] == 2 | ||
| assert preset["prConcurrentLimit"] == 3 | ||
| assert preset["branchConcurrentLimit"] == 3 | ||
| assert preset["prCreation"] == "not-pending" | ||
| assert preset["minimumReleaseAge"] == "3 days" | ||
|
|
||
|
|
||
| def test_trusted_action_digests_are_grouped() -> None: | ||
| rule = _rule(_preset(), matchManagers=["github-actions"]) | ||
|
|
||
| assert rule["matchUpdateTypes"] == ["digest", "pin", "minor", "patch"] | ||
| assert rule["groupName"] == "github-actions" | ||
| assert rule["automerge"] is True | ||
|
|
||
|
|
||
| def test_fleet_preset_keeps_workflows_owned_dev_tool_pins_out_of_renovate() -> None: | ||
| rule = _rule(_preset(), enabled=False) | ||
|
|
||
| assert rule["matchPackageNames"] == [ | ||
| "ruff", | ||
| "black", | ||
| "mypy", | ||
| "pytest", | ||
| "pytest-cov", | ||
| "pytest-xdist", | ||
| "coverage", | ||
| "isort", | ||
| "docformatter", | ||
| ] | ||
|
|
||
|
|
||
| def test_vulnerability_alerts_bypass_routine_intake_delays() -> None: | ||
| alerts = _preset()["vulnerabilityAlerts"] | ||
|
|
||
| assert alerts == { | ||
| "schedule": [], | ||
| "minimumReleaseAge": None, | ||
| "prCreation": "immediate", | ||
| } | ||
|
|
||
|
|
||
| def test_major_updates_stay_visible_but_require_dashboard_approval() -> None: | ||
| preset = _preset() | ||
| rule = _rule(preset, matchUpdateTypes=["major"]) | ||
|
|
||
| assert preset["dependencyDashboard"] is True | ||
| assert rule["dependencyDashboardApproval"] is True | ||
| assert rule["automerge"] is False | ||
|
|
||
|
|
||
| def test_lock_file_maintenance_has_the_same_explicit_weekly_cadence() -> None: | ||
|
stranske marked this conversation as resolved.
|
||
| lock_maintenance = _preset()["lockFileMaintenance"] | ||
|
|
||
| assert lock_maintenance == { | ||
| "enabled": True, | ||
| "groupName": "weekly lock file maintenance", | ||
| "schedule": ["after 1am and before 5am on monday"], | ||
| } | ||
|
|
||
|
|
||
| def test_workflows_and_consumer_entrypoints_share_the_bounded_fleet_policy() -> None: | ||
| expected_preset = "github>stranske/Workflows//renovate-presets/fleet" | ||
| entrypoints = ( | ||
| REPO_ROOT / "renovate.json", | ||
| REPO_ROOT / "templates" / "consumer-repo" / ".github" / "renovate.json", | ||
| ) | ||
|
|
||
| for entrypoint in entrypoints: | ||
| config = json.loads(entrypoint.read_text(encoding="utf-8")) | ||
| assert config["extends"] == [expected_preset] | ||
|
|
||
| preset = _preset() | ||
| assert preset["prConcurrentLimit"] == preset["branchConcurrentLimit"] == 3 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.