Skip to content

Commit 554284b

Browse files
committed
Improve warn messages for empty tag scenarios
Distinguish between registry returning no tags vs strategy/constraint filtering all tags out, so operators can diagnose the root cause. Signed-off-by: Mark Liu <mark@prove.com.au>
1 parent c41f9d7 commit 554284b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

registry-scanner/pkg/image/version.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ func (img *ContainerImage) GetNewestVersionFromTags(ctx context.Context, vc *Ver
100100

101101
// It makes no sense to proceed if we have no available tags
102102
if len(availableTags) == 0 {
103-
logCtx.Warnf("no tags found for image %s in registry", img.GetFullNameWithoutTag())
103+
if len(tagList.Tags()) > 0 {
104+
logCtx.Warnf("no tags for image %s matched by the %s strategy", img.GetFullNameWithoutTag(), vc.Strategy)
105+
} else {
106+
logCtx.Warnf("no tags found for image %s in registry", img.GetFullNameWithoutTag())
107+
}
104108
return nil, nil
105109
}
106110

@@ -154,6 +158,7 @@ func (img *ContainerImage) GetNewestVersionFromTags(ctx context.Context, vc *Ver
154158
return considerTags[len(considerTags)-1], nil
155159
}
156160

161+
logCtx.Warnf("no tags for image %s matched constraint %q", img.GetFullNameWithoutTag(), vc.Constraint)
157162
return nil, nil
158163
}
159164

0 commit comments

Comments
 (0)