Skip to content

Commit

Permalink
Verify-dockerfile Ignore scratch images (#509)
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Brown <rjbrown57@gmail.com>
  • Loading branch information
rjbrown57 committed Jul 30, 2021
1 parent f3cf4a2 commit 4877fbb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/cosign/cli/verify_dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4877fbb

Please sign in to comment.