-
Notifications
You must be signed in to change notification settings - Fork 1
fix(ci): reduce Dependabot queue fanout #1153
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
Draft
seonghobae
wants to merge
12
commits into
develop
Choose a base branch
from
chore/paths-ignore-fix
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
900ad68
fix(ci): skip docs-only changes for bandit, codeql, trivy
seonghobae 82eb38c
fix(ci): preserve protected security scans
seonghobae 0a328af
chore(ci): merge current protected develop into workflow repair
seonghobae 0f1dd76
fix(dependabot): group GitHub Actions updates
seonghobae ac90d5a
fix(dependabot): drop nonexistent github-actions label
seonghobae f87338c
test(dependabot): require bounded nonmajor dev grouping
seonghobae d3dd530
fix(dependabot): group nonmajor npm development updates
seonghobae bda7957
test(dependabot): require grouped action security updates
seonghobae bb54435
fix(dependabot): group action security updates separately
seonghobae 5eef6ec
fix(test): bound Dependabot group parsing by indentation
seonghobae 100c1e3
chore(ci): leave Bandit PR policy to canonical security dedupe lane
seonghobae c4fec43
chore(ci): adopt protected Bandit blob
seonghobae 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
67 changes: 67 additions & 0 deletions
67
services/analysis-engine/tests/test_dependabot_queue_policy.py
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,67 @@ | ||
| """Executable queue-shaping contracts for Dependabot update proposals.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
||
| REPO_ROOT = Path(__file__).resolve().parents[3] | ||
| DEPENDABOT_CONFIG = REPO_ROOT / ".github" / "dependabot.yml" | ||
|
|
||
|
|
||
| def _ecosystem_block(name: str) -> str: | ||
| """Return one Dependabot ecosystem block without parsing unrelated YAML.""" | ||
| content = DEPENDABOT_CONFIG.read_text(encoding="utf-8") | ||
| marker = f' - package-ecosystem: "{name}"' | ||
| if marker not in content: | ||
| raise AssertionError(f"Dependabot ecosystem is missing: {name}") | ||
| start = content.index(marker) | ||
| next_start = content.find("\n - package-ecosystem:", start + len(marker)) | ||
| return content[start:] if next_start == -1 else content[start:next_start] | ||
|
|
||
|
|
||
| def _group_block(ecosystem_block: str, name: str) -> str: | ||
| """Return one group body, stopping only at the next six-space sibling key.""" | ||
| marker = f" {name}:" | ||
| if marker not in ecosystem_block: | ||
| raise AssertionError(f"Dependabot group is missing: {name}") | ||
| group = ecosystem_block.split(marker, 1)[1] | ||
| lines = group.splitlines() | ||
| body: list[str] = [] | ||
| for line in lines: | ||
| if line.startswith(" ") and not line.startswith(" "): | ||
| break | ||
| body.append(line) | ||
| return "\n".join(body) | ||
|
|
||
|
|
||
| def test_npm_development_nonmajor_updates_are_grouped() -> None: | ||
| """Keep routine npm tooling updates from recreating one-PR-per-package fanout.""" | ||
| block = _ecosystem_block("npm") | ||
| group = _group_block(block, "npm-development-nonmajor") | ||
|
|
||
| assert ' dependency-type: "development"' in group | ||
| assert " update-types:" in group | ||
| assert ' - "minor"' in group | ||
| assert ' - "patch"' in group | ||
| assert ' - "major"' not in group | ||
| assert " patterns:" in group | ||
| assert ' - "*"' in group | ||
|
|
||
|
|
||
| def test_github_actions_version_updates_remain_grouped() -> None: | ||
| """Keep action version updates consolidated inside their ecosystem boundary.""" | ||
| block = _ecosystem_block("github-actions") | ||
| group = _group_block(block, "github-actions") | ||
|
|
||
| assert ' applies-to: "version-updates"' in group | ||
| assert " patterns:" in group | ||
| assert ' - "*"' in group | ||
|
|
||
|
|
||
| def test_github_actions_security_updates_are_grouped_separately() -> None: | ||
| """Consolidate action security updates without mixing them with version updates.""" | ||
| block = _ecosystem_block("github-actions") | ||
| group = _group_block(block, "github-actions-security") | ||
|
|
||
| assert ' applies-to: "security-updates"' in group | ||
| assert " patterns:" in group | ||
| assert ' - "*"' in group |
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.