@@ -15,22 +15,21 @@ import (
15
15
"io"
16
16
"os"
17
17
"reflect"
18
+ "slices"
18
19
"strings"
19
20
"sync"
20
21
21
22
"github.com/aquasecurity/trivy/pkg/fanal/analyzer"
23
+ _ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/all"
22
24
"github.com/aquasecurity/trivy/pkg/fanal/artifact"
23
25
"github.com/aquasecurity/trivy/pkg/fanal/handler"
24
26
"github.com/aquasecurity/trivy/pkg/fanal/types"
25
27
"github.com/aquasecurity/trivy/pkg/fanal/walker"
26
28
v1 "github.com/google/go-containerregistry/pkg/v1"
27
29
"github.com/samber/lo"
28
30
"github.com/sirupsen/logrus"
29
- "slices"
30
31
"golang.org/x/sync/semaphore"
31
32
32
- _ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/all"
33
-
34
33
_ "github.com/castai/image-analyzer/apk"
35
34
_ "github.com/castai/image-analyzer/dpkg"
36
35
_ "github.com/castai/image-analyzer/rpm"
@@ -128,12 +127,16 @@ func (a Artifact) Inspect(ctx context.Context) (*ArtifactReference, error) {
128
127
129
128
// Convert image ID and layer IDs to cache keys
130
129
imageKey , layerKeys , layerKeyMap := a .calcCacheKeys (imageID , diffIDs )
130
+ a .log .Debugf ("image key: %s" , imageKey )
131
+ a .log .Debugf ("layer keys: %v" , layerKeys )
132
+ a .log .Debugf ("layer key map: %v" , layerKeyMap )
131
133
132
134
// Check if image artifact info already cached.
133
135
cachedArtifactInfo , err := a .getCachedArtifactInfo (ctx , imageKey )
134
136
if err != nil && ! errors .Is (err , ErrCacheNotFound ) {
135
- return nil , err
137
+ return nil , fmt . Errorf ( "unable to access artifact cache: %w" , err )
136
138
}
139
+
137
140
var missingImageKey string
138
141
if cachedArtifactInfo == nil {
139
142
missingImageKey = imageKey
@@ -142,7 +145,7 @@ func (a Artifact) Inspect(ctx context.Context) (*ArtifactReference, error) {
142
145
// Find cached layers
143
146
cachedLayers , err := a .getCachedLayers (ctx , layerKeys )
144
147
if err != nil {
145
- return nil , err
148
+ return nil , fmt . Errorf ( "unable to access layers cache: %w" , err )
146
149
}
147
150
missingLayersKeys := lo .Filter (layerKeys , func (v string , _ int ) bool {
148
151
_ , ok := cachedLayers [v ]
0 commit comments