From c99876b315dcc7a4861dec06e3d01caf4c070628 Mon Sep 17 00:00:00 2001 From: Russell Brown Date: Fri, 30 Jul 2021 11:00:05 -0500 Subject: [PATCH] Verify-dockerfile Ignore scratch images Signed-off-by: Russell Brown --- cmd/cosign/cli/verify_dockerfile.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/cosign/cli/verify_dockerfile.go b/cmd/cosign/cli/verify_dockerfile.go index 882d4df10fc..a76a10e0876 100644 --- a/cmd/cosign/cli/verify_dockerfile.go +++ b/cmd/cosign/cli/verify_dockerfile.go @@ -118,7 +118,12 @@ func getImagesFromDockerfile(dockerfile io.Reader) ([]string, error) { for fileScanner.Scan() { line := strings.TrimSpace(fileScanner.Text()) if strings.HasPrefix(line, "FROM") { - images = append(images, getImageFromLine(line)) + switch image := getImageFromLine(line); image { + case "scratch": + fmt.Fprintln(os.Stderr, "- scratch image ignored") + default: + images = append(images, image) + } } } if err := fileScanner.Err(); err != nil {