Skip to content

Commit

Permalink
rhcc: don't fatally error on unexpected Dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Jun 8, 2022
1 parent dc939a0 commit 4059faf
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions rhel/rhcc/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"net/http"
"os"
Expand Down Expand Up @@ -129,17 +128,21 @@ func (s *scanner) Scan(ctx context.Context, l *claircore.Layer) ([]*claircore.Pa
// such as UBI.
return nil, nil
}
buildName, ok := labels[compLabel]
if !ok {
return nil, fmt.Errorf("expected label %s not found in dockerfile", compLabel)
}
arch, ok := labels[archLabel]
if !ok {
return nil, fmt.Errorf("expected label %s not found in dockerfile", archLabel)
}
name, ok := labels[nameLabel]
if !ok {
return nil, fmt.Errorf("expected label %s not found in dockerfile", nameLabel)
var buildName, arch, name string
for _, chk := range []struct {
Found *string
Want string
}{
{&buildName, compLabel},
{&arch, archLabel},
{&name, nameLabel},
} {
var ok bool
(*chk.Found), ok = labels[chk.Want]
if !ok {
zlog.Info(ctx).Str("label", chk.Want).Msg("expected label not found in dockerfile")
return nil, nil
}
}

minorRange := rhctagVersion.MinorStart()
Expand Down

0 comments on commit 4059faf

Please sign in to comment.