From 4fae7d93e0c07d5f6fc4c33db389c60d95276d01 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 31 Jan 2022 17:09:16 +0000 Subject: pipeline: Fail if no images are present --- internal/pipeline/put.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/pipeline') diff --git a/internal/pipeline/put.go b/internal/pipeline/put.go index 68ad70e..aba9e0e 100644 --- a/internal/pipeline/put.go +++ b/internal/pipeline/put.go @@ -51,6 +51,7 @@ func CheckImages(ctx context.Context, dir string) error { close(checker) }() + n := 0 for path := range checker { select { case <-ctx.Done(): @@ -70,6 +71,11 @@ func CheckImages(ctx context.Context, dir string) error { if err != nil { return fmt.Errorf("Decoding image %s failed: %v", path, err) } + n++ + } + + if n == 0 { + return fmt.Errorf("No images found") } return nil -- cgit v1.2.1-24-ge1ad