Skip to content

HMS-5947: fix delete-snapshots glitchtip errors #1124

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 1 commit into from
Jun 18, 2025

Conversation

xbhouse
Copy link
Contributor

@xbhouse xbhouse commented Jun 11, 2025

Summary

Template distributions were not being updated when cleaning up outdated snapshots for RH repos, resulting in failed deletion of repo versions. There might be other issues at play here, so I've left in the debug logs for now.

Testing steps

I haven't found a way to test this without multiple RH snapshots, this hasn't been reproducible for me locally with custom or EPEL repos. If you have multiple RH snapshots, you can follow these steps:

  1. Create a template with just the base RH repos for any version or arch. Set to a date earlier than the oldest snapshot so it uses the oldest
  2. Update one of the RH repo's oldest snapshot so that it is set to be cleaned up. You can use this query: UPDATE snapshots SET created_at = (NOW() - CAST('365 days' AS INTERVAL)) WHERE uuid = '<snapshot_uuid>';
  3. Confirm the template now shows a warning that some repos have snapshots that are soon to be deleted.
  4. Grab the pulp URL to the snapshot you'll be deleting so we can verify it doesn't exist later.
  5. Run the snapshot cleanup task: go run cmd/external-repos/main.go cleanup --type snapshot
  6. Follow the logs, you shouldn't see errors related to existing distributions and the task should succeed.
  7. In the template, the warning should disappear and you should see the next available snapshot of that RH repo on that template.
  8. The RH snapshot should be fully deleted (not available when viewing snapshots in the UI or listing via the API, not stuck in a soft-deleted state in the DB, and the older snapshot URL should give you a 404).

@jlsherrill
Copy link
Member

@xbhouse xbhouse marked this pull request as ready for review June 16, 2025 13:55
Copy link
Contributor

@dominikvagner dominikvagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! thank for finding this issue and fixing it, good job 👏🏼😇
tested it locally, with simulated old RH snaps and everything seems to work as it should 🎉
approved ✅

@xbhouse xbhouse merged commit c618933 into content-services:main Jun 18, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants