Repository navigation
fix(container): fix GHCR PR tag cleanup credentials, pagination, error logging, and shared-tag safety - #1331
Conversation
…red tags in GHCR PR tag cleanup
- Authenticate GHCR Packages API requests in `_delete_ghcr_tag_via_github_api` with `container_repository_password` (closing the temporary PyGithub client in `finally`), falling back to `github_api` only when unset
- Paginate `GET /{scope}/{owner}/packages/container/{package_name}/versions` with `per_page=100` until an empty or short page is returned, deduplicating version IDs across pages
- Skip deleting any package version sharing additional tags (e.g. `latest`, release tags, or other PR tags) and log a warning instead
- Include HTTP status and redacted response data in `GithubException` error logs
- Update operator docs and add unit tests covering credentials, pagination, shared-tag safety, and secret redaction
Fixes #1330
Assisted-by: PI (gemini-4-neon)
Signed-off-by: Meni Yakove <myakove@gmail.com>
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
PR Summary by QodoFix GHCR PR tag cleanup credentials, pagination, and shared-tag safety
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
- Format and redact tracebacks via `traceback.format_exc()` and log with `logger.error()` (no raw `exc_info`) so container tokens cannot leak in error traces - Set `deleted_any = True` only when `DELETE` actually succeeds, avoiding duplicate PR comments on 404 - Scan version pages incrementally and stop paginating as soon as `pr_tag` is found - Update unit tests (including real-logger redaction test) and docs wording Assisted-by: PI (gemini-4-neon) Signed-off-by: Meni Yakove <myakove@gmail.com>
|
Code review by qodo was updated up to the latest commit 293ae57 |
|
/approve Verification Evidence (
|
|
New container for ghcr.io/myk-org/github-webhook-server:latest published |
Closes #1330
Summary
container_repository_passwordviaget_github_client()for GHCR Packages REST API calls inPullRequestHandler._delete_ghcr_tag_via_github_api, closing the client infinally:and falling back toself.github_webhook.github_apionly when unset.GET /{scope}/{owner}/packages/container/{package_name}/versionswithper_page=100until an empty or short page is returned, keepingorgs->users404 fallback and deduplicating version IDs across page boundaries.latest, release tags, or otherpr-*tags) and log a warning instead; post the PR removal comment only when a version was actually deleted.ex.statusand redactedex.dataonGithubExceptionfailures (and redacted error text on generic exceptions) respectingmask_sensitive.docs/configuration-reference.mdanddocs/set-up-checks-and-release-workflows.md, and add unit tests covering credential selection/fallback, multi-page pagination, deduplication, shared-tag preservation, and secret redaction.Verification
uvx prek run --all-files: passed (all 20 hooks)uvx tox: passed (unused-codeOK,unittests: 2496 passed, 91.59% coverage)myk-org/for-testing-only: pending post-Qodo approvalAssisted-by: PI (gemini-4-neon)