Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit ebed97b

Browse files
committed
Emit warning if querys don’t work
Signed-off-by: Christian Dupuis <[email protected]>
1 parent ce625cf commit ebed97b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

commands/cmd.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ func NewRootCmd(name string, isPlugin bool, dockerCli command.Cli) *cobra.Comman
129129
apiKey, _ := config.PluginConfig("index", "api-key")
130130
cves, err := query.QueryCves(sb, "", workspace, apiKey)
131131
if err != nil {
132-
return err
132+
skill.Log.Warnf("error running cve query")
133+
}
134+
if cves != nil {
135+
sb.Vulnerabilities = *cves
133136
}
134-
sb.Vulnerabilities = *cves
135137
}
136138
if includeBaseImages {
137139
bi, err := query.ForBaseImageInGraphQL(sb.Source.Image.Config, true)
138140
if err != nil {
139-
return err
141+
skill.Log.Warnf("error running base image query")
140142
}
141143
if bi != nil && len(bi.ImagesByDiffIds) > 0 {
142144
sb.Source.BaseImages = bi.ImagesByDiffIds

query/query.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ func QueryCves(sb *types.Sbom, cve string, workspace string, apiKey string) (*[]
7575
name = "cve_query"
7676
}
7777
resp, err := query(q, name, workspace, apiKey)
78+
if err != nil {
79+
return nil, errors.Wrapf(err, "failed to run query")
80+
}
7881
var result QueryResult
7982
err = edn.NewDecoder(resp.Body).Decode(&result)
8083
if err != nil {

0 commit comments

Comments
 (0)