Skip to content

Commit 949f238

Browse files
committed
skip untagged versions
1 parent 0b6169f commit 949f238

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

ci/cleanup-images.sh

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ echo -e "${GREEN}Container Image Cleanup Script${NC}"
106106
echo "================================"
107107
registry_print_config
108108
echo "Deleting versions older than: $CUTOFF_DATE ($DAYS_OLD days)"
109-
echo "Preserving: 'main' tag and version tags (e.g., 5, 5.10, 1.2.3), excluding arch-specific tags (e.g., 5.1.5-arm64)"
109+
echo "Preserving: 'main' tag, version tags (e.g., 5, 5.10, 1.2.3), and untagged versions (multi-arch manifests)"
110+
echo "Deleting: old branch/PR tags (e.g., pr-123), arch-specific tags (e.g., 5.1.5-arm64)"
110111
if [ "$DRY_RUN" = "true" ]; then
111112
echo -e "Mode: ${YELLOW}DRY RUN${NC} (no deletions will occur)"
112113
else
@@ -143,13 +144,6 @@ is_older_than_cutoff() {
143144
# Fetch all versions
144145
echo "Fetching all versions..."
145146
ALL_VERSIONS=$(registry_fetch_all_versions)
146-
147-
# Build a list of digests from preserved versions (main and semver tags)
148-
echo "Identifying preserved versions and their dependencies..."
149-
PRESERVED_DIGESTS=$(registry_get_preserved_digests "$ALL_VERSIONS")
150-
151-
PRESERVED_COUNT_DIGESTS=$(echo "$PRESERVED_DIGESTS" | grep -c . || echo "0")
152-
echo "Found $PRESERVED_COUNT_DIGESTS preserved digests"
153147
echo ""
154148

155149
# Create temp files for counters (to avoid subshell issues)
@@ -178,17 +172,10 @@ while read -r version; do
178172
VERSION_DIGEST=$(registry_get_version_digest "$version")
179173
TAGS=$(registry_get_version_tags "$version")
180174

181-
# Default to untagged if no tags
175+
# Skip untagged versions - they may be platform-specific manifests referenced by multi-arch tags
182176
if [ -z "$TAGS" ]; then
183-
TAG_DISPLAY="<untagged>"
184-
SHOULD_DELETE=true
185-
186-
# Check if this untagged version is a preserved digest (referenced by a kept tag)
187-
if echo "$PRESERVED_DIGESTS" | grep -qF "$VERSION_DIGEST"; then
188-
SHOULD_DELETE=false
189-
echo -e "${YELLOW}[$CURRENT/$TOTAL_VERSIONS] Preserving${NC} version $VERSION_ID (digest: ${VERSION_DIGEST:0:20}...) - referenced by preserved tag"
190-
echo $(($(cat "$TEMP_DIR/preserved") + 1)) > "$TEMP_DIR/preserved"
191-
fi
177+
echo -e "${YELLOW}[$CURRENT/$TOTAL_VERSIONS] Skipping${NC} version $VERSION_ID (untagged) - may be referenced by multi-arch manifest"
178+
continue
192179
else
193180
TAG_DISPLAY="$TAGS"
194181
SHOULD_DELETE=true

0 commit comments

Comments
 (0)