Skip to content

Fix flaky CR-cache E2E teardown: drain orphaned PackageRev CRs - #1167

Open
efiacor wants to merge 1 commit into
kptdev:mainfrom
Nordix:fix_cr_cache_ci
Open

Fix flaky CR-cache E2E teardown: drain orphaned PackageRev CRs#1167
efiacor wants to merge 1 commit into
kptdev:mainfrom
Nordix:fix_cr_cache_ci

Conversation

@efiacor

@efiacor efiacor commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

  • What changed: WaitUntilAllPackageRevsDeleted now force-drains leftover internal PackageRev CRs on every poll iteration. Replaced removePkgRevFinalizers with forceDeletePkgRev, which issues a delete then clears finalizers (with conflict-retry).

  • Why it’s needed: The nightly "E2E Tests (CR Cache)" job failed every run with FATAL: PackageRevs from repo <x> still remain. After a repository is deleted, orphaned internal PackageRev CRs are left behind with no controller to drain them. The old helper only cleared finalizers when present and never issued a delete, so an orphan with no deletionTimestamp was never removed. The poll then spun until the 60s timeout and FATAL'd, failing whichever test owned that repo.

  • How it works: Deleting first sets a deletionTimestamp even when no finalizers exist; clearing finalizers then lets the deletion complete. Running every iteration ensures the poll retries until the CRs actually drain to zero.


Related Issue(s)

  • Closes/Fixes #

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

Testing Instructions (Optional)

  1. Run the CR-cache E2E suite (make test-e2e against a CR-cache deployment).
  2. Confirm TestBasicLifecycle / TestPackageRevisionMetadata teardown no longer FATALs with "PackageRevs from repo ... still remain".

Additional Notes (Optional)

  • Known issues: If orphaned CRs are stuck Terminating on a finalizer re-added by the CR cache, this test-side drain may still not clear them; that would point to a controller-side issue in the repository deletion path.
  • Review notes: No repository-controller behaviour changed — fix is confined to the E2E suite helper.

AI Disclosure

  • I have used AI in the creation of this PR.

If so, please describe how:

  • Kiro to analyse the failing CI runs and server/controller logs, identify the root cause, and implement the test helper fix.

Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
@efiacor
efiacor requested review from a team September 1, 2026 14:52
@github-actions
github-actions Bot requested a lite review from Copilot September 1, 2026 14:52
@netlify

netlify Bot commented Sep 1, 2026

Copy link
Copy Markdown

Deploy Preview for kpt-porch ready!

Name Link
🔨 Latest commit 0795114
🔍 Latest deploy log https://app.netlify.com/projects/kpt-porch/deploys/6a96e69464de2400082a051a
😎 Deploy Preview https://deploy-preview-1167--kpt-porch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Pull request overview

This PR fixes flaky CR-cache E2E teardown by ensuring orphaned internal PackageRev CRs are actively drained after their parent repository is deleted, preventing timeouts that previously caused the CR-cache nightly E2E job to fail.

Changes:

  • Update WaitUntilAllPackageRevsDeleted to attempt cleanup on every poll iteration by force-deleting any remaining internal PackageRev CRs.
  • Replace the finalizer-only helper with forceDeletePkgRev, which issues a Delete first (to set deletionTimestamp) and then clears finalizers with conflict retries.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

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