Skip to content

Comments

Have dockerhub cleanup use same logic as ghcr cleanup [skip-release]#533

Merged
aOelschlager merged 5 commits intomainfrom
issue-403
Jan 28, 2026
Merged

Have dockerhub cleanup use same logic as ghcr cleanup [skip-release]#533
aOelschlager merged 5 commits intomainfrom
issue-403

Conversation

@joecorall
Copy link
Contributor

@joecorall joecorall commented Jan 22, 2026

This PR has our dockerhub and GHCR docker image cleanup logic use the same bash scripts, replacing the kotlin plugin for dockerhub. The logic is:

  • Always keep semver tags ([0-9]+\.[0-9]+\.[0-9]+ with minor/patch being optional)
  • Always keep main tags
  • Delete any other tags older than 90d
  • Only issue DELETE API calls if --yolo flag is passed

Before passing the --yolo flag I ran the job on base and it would cleanup the following images (output in code block below)

I ran a full job here so we can see what it would delete: https://github.com/Islandora-Devops/isle-buildkit/actions/runs/21253820679

Then added the --yolo flag to the job, so this will run on Sundays again once this merges. a648dc6

Authenticating with Docker Hub...
Authentication successful.

Container Image Cleanup Script
================================
Registry: Docker Hub
Namespace: islandora
Repository: base
Deleting versions older than: 2025-10-24T14:47:58Z (90 days)
Preserving: 'main' tag and version tags (e.g., 5, 5.10, 1.2.3), excluding arch-specific tags (e.g., 5.1.5-arm64)
Mode: DRY RUN (no deletions will occur)

Fetching all versions...
Identifying preserved versions and their dependencies...
Found 66 preserved digests

Processing versions...
Total versions to process: 228

[1/228] Keeping version issue-403-arm64 (tags: issue-403-arm64, updated: 2026-01-22T14:46:53.120751Z) - too recent
[2/228] Keeping version issue-403-amd64 (tags: issue-403-amd64, updated: 2026-01-22T14:46:46.816535Z) - too recent
[3/228] Keeping version issue-403 (tags: issue-403, updated: 2026-01-22T14:38:34.510878Z) - too recent
[4/228] Preserving version 5.1.5 (tag: 5.1.5) - version tag
[5/228] Preserving version 5.1 (tag: 5.1) - version tag
[6/228] Preserving version 5 (tag: 5) - version tag
[7/228] Preserving version 3.6.0 (tag: 3.6.0) - version tag
[8/228] Preserving version 3.6 (tag: 3.6) - version tag
[9/228] Preserving version 3 (tag: 3) - version tag
[10/228] Keeping version 5.1.5-arm64 (tags: 5.1.5-arm64, updated: 2026-01-22T14:14:55.883144Z) - too recent
[11/228] Keeping version 3.6.0-arm64 (tags: 3.6.0-arm64, updated: 2026-01-22T14:14:52.182303Z) - too recent
[12/228] Keeping version 5.1.5-amd64 (tags: 5.1.5-amd64, updated: 2026-01-22T14:14:49.081689Z) - too recent
[13/228] Keeping version 3.6.0-amd64 (tags: 3.6.0-amd64, updated: 2026-01-22T14:13:04.934862Z) - too recent
[14/228] Keeping version issue-479 (tags: issue-479, updated: 2026-01-22T13:58:45.783021Z) - too recent
[15/228] Keeping version issue-479-arm64 (tags: issue-479-arm64, updated: 2026-01-22T13:58:25.773787Z) - too recent
[16/228] Keeping version issue-479-amd64 (tags: issue-479-amd64, updated: 2026-01-22T13:58:20.150378Z) - too recent
[17/228] Preserving version 6.2.1 (tag: 6.2.1) - version tag
[18/228] Preserving version 6.2 (tag: 6.2) - version tag
[19/228] Preserving version 6 (tag: 6) - version tag
[20/228] Keeping version 6.2.1-arm64 (tags: 6.2.1-arm64, updated: 2026-01-22T08:05:47.174656Z) - too recent
[21/228] Keeping version 6.2.1-amd64 (tags: 6.2.1-amd64, updated: 2026-01-22T08:05:44.113972Z) - too recent
[22/228] Preserving version 4.3.18 (tag: 4.3.18) - version tag
[23/228] Preserving version 4 (tag: 4) - version tag
[174/228] Preserving version 3.4.2 (tag: 3.4.2) - version tag
[175/228] [DRY RUN] Would delete version 3.4.2-arm64 (tags: 3.4.2-arm64, updated: 2024-09-12T22:04:45.269269Z)
[176/228] [DRY RUN] Would delete version 3.4.2-amd64 (tags: 3.4.2-amd64, updated: 2024-09-12T22:04:44.909824Z)
[177/228] Preserving version 3.2.7 (tag: 3.2.7) - version tag
[178/228] [DRY RUN] Would delete version 3.2.7-amd64 (tags: 3.2.7-amd64, updated: 2024-06-06T10:38:17.519837Z)
[179/228] Preserving version 3.2.6 (tag: 3.2.6) - version tag
[180/228] [DRY RUN] Would delete version 3.2.6-amd64 (tags: 3.2.6-amd64, updated: 2024-06-05T17:10:41.577836Z)
[181/228] Preserving version 3.2.5 (tag: 3.2.5) - version tag
[182/228] [DRY RUN] Would delete version 3.2.5-arm64 (tags: 3.2.5-arm64, updated: 2024-05-31T22:38:17.113341Z)
[183/228] [DRY RUN] Would delete version 3.2.5-amd64 (tags: 3.2.5-amd64, updated: 2024-05-31T22:38:16.366014Z)
[184/228] Preserving version 3.2.4 (tag: 3.2.4) - version tag
[185/228] [DRY RUN] Would delete version 3.2.4-arm64 (tags: 3.2.4-arm64, updated: 2024-05-13T16:51:04.00883Z)
[186/228] [DRY RUN] Would delete version 3.2.4-amd64 (tags: 3.2.4-amd64, updated: 2024-05-13T16:51:03.715924Z)
[187/228] Preserving version 3.2.3 (tag: 3.2.3) - version tag
[188/228] [DRY RUN] Would delete version 3.2.3-amd64 (tags: 3.2.3-amd64, updated: 2024-04-30T16:37:05.014506Z)
[189/228] [DRY RUN] Would delete version 3.2.3-arm64 (tags: 3.2.3-arm64, updated: 2024-04-30T16:37:04.374004Z)
[190/228] Preserving version 3.2.2 (tag: 3.2.2) - version tag
[191/228] [DRY RUN] Would delete version 3.2.2-amd64 (tags: 3.2.2-amd64, updated: 2024-04-19T16:27:54.89767Z)
[192/228] [DRY RUN] Would delete version 3.2.2-arm64 (tags: 3.2.2-arm64, updated: 2024-04-19T16:27:54.046306Z)
[193/228] Preserving version 3.2.1 (tag: 3.2.1) - version tag
[194/228] [DRY RUN] Would delete version 3.2.1-arm64 (tags: 3.2.1-arm64, updated: 2024-04-10T20:41:24.38929Z)
[195/228] [DRY RUN] Would delete version 3.2.1-amd64 (tags: 3.2.1-amd64, updated: 2024-04-10T20:41:24.225117Z)
[196/228] Preserving version 3.2.0 (tag: 3.2.0) - version tag
[197/228] [DRY RUN] Would delete version 3.2.0-arm64 (tags: 3.2.0-arm64, updated: 2024-04-10T17:35:12.258932Z)
[198/228] [DRY RUN] Would delete version 3.2.0-amd64 (tags: 3.2.0-amd64, updated: 2024-04-10T17:35:00.403337Z)
[199/228] Preserving version 3.1.6 (tag: 3.1.6) - version tag
[200/228] [DRY RUN] Would delete version 3.1.6-amd64 (tags: 3.1.6-amd64, updated: 2024-04-08T17:54:39.827294Z)
[201/228] [DRY RUN] Would delete version 3.1.6-arm64 (tags: 3.1.6-arm64, updated: 2024-04-08T17:54:39.103609Z)
[202/228] Preserving version 3.1.5 (tag: 3.1.5) - version tag
[203/228] [DRY RUN] Would delete version 3.1.5-arm64 (tags: 3.1.5-arm64, updated: 2024-03-05T00:42:51.730645Z)
[204/228] [DRY RUN] Would delete version 3.1.5-amd64 (tags: 3.1.5-amd64, updated: 2024-03-05T00:42:51.546514Z)
[205/228] Preserving version 3.1.4 (tag: 3.1.4) - version tag
[206/228] [DRY RUN] Would delete version 3.1.4-arm64 (tags: 3.1.4-arm64, updated: 2024-02-14T18:16:10.546948Z)
[207/228] [DRY RUN] Would delete version 3.1.4-amd64 (tags: 3.1.4-amd64, updated: 2024-02-14T18:16:09.191949Z)
[208/228] Preserving version 3.1.3 (tag: 3.1.3) - version tag
[209/228] [DRY RUN] Would delete version 3.1.3-amd64 (tags: 3.1.3-amd64, updated: 2024-01-30T19:38:13.51948Z)
[210/228] [DRY RUN] Would delete version 3.1.3-arm64 (tags: 3.1.3-arm64, updated: 2024-01-30T19:38:12.900781Z)
[211/228] Preserving version 3.1.2 (tag: 3.1.2) - version tag
[212/228] [DRY RUN] Would delete version 3.1.2-amd64 (tags: 3.1.2-amd64, updated: 2024-01-25T19:23:37.686924Z)
[213/228] [DRY RUN] Would delete version 3.1.2-arm64 (tags: 3.1.2-arm64, updated: 2024-01-25T19:23:37.644566Z)
[214/228] Preserving version 3.1.1 (tag: 3.1.1) - version tag
[215/228] [DRY RUN] Would delete version 3.1.1-arm64 (tags: 3.1.1-arm64, updated: 2024-01-04T21:28:57.568278Z)
[216/228] [DRY RUN] Would delete version 3.1.1-amd64 (tags: 3.1.1-amd64, updated: 2024-01-04T21:28:57.508494Z)
[217/228] Preserving version 3.1.0 (tag: 3.1.0) - version tag
[218/228] [DRY RUN] Would delete version 3.1.0-arm64 (tags: 3.1.0-arm64, updated: 2023-12-31T11:46:06.934822Z)
[219/228] [DRY RUN] Would delete version 3.1.0-amd64 (tags: 3.1.0-amd64, updated: 2023-12-31T11:46:06.698217Z)
[220/228] Preserving version 3.0.8 (tag: 3.0.8) - version tag
[221/228] [DRY RUN] Would delete version 3.0.8-arm64 (tags: 3.0.8-arm64, updated: 2023-12-21T13:55:18.321531Z)
[222/228] [DRY RUN] Would delete version 3.0.8-amd64 (tags: 3.0.8-amd64, updated: 2023-12-21T13:55:18.026679Z)
[223/228] Preserving version 2.0.10 (tag: 2.0.10) - version tag
[224/228] [DRY RUN] Would delete version 2.0.10-amd64 (tags: 2.0.10-amd64, updated: 2023-11-07T16:43:55.631923Z)
[225/228] Preserving version 2.0.9 (tag: 2.0.9) - version tag
[226/228] [DRY RUN] Would delete version 2.0.9-amd64 (tags: 2.0.9-amd64, updated: 2023-11-03T11:47:16.331537Z)
[227/228] Preserving version 2.0.8 (tag: 2.0.8) - version tag
[228/228] [DRY RUN] Would delete version 2.0.8-amd64 (tags: 2.0.8-amd64, updated: 2023-11-01T22:39:45.096863Z)

===========================

This gives us better visibility into what is happening in the job, and has dockerhub and GHCR use the same logic. The gradle plugin was pretty silent so was difficult to tell what it was doing on a given run.

Relates to #531
Closes #403

@joecorall joecorall changed the title Have dockerhub cleanup use same logic as ghcr cleanup Have dockerhub cleanup use same logic as ghcr cleanup [skip-release] Jan 22, 2026
@joecorall joecorall marked this pull request as ready for review January 22, 2026 14:57
@aOelschlager aOelschlager merged commit d0b19ad into main Jan 28, 2026
140 checks passed
@aOelschlager aOelschlager deleted the issue-403 branch January 28, 2026 18:39
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.

Rate limites on Docker hub is causing the auto delete tags to fail

2 participants