Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add k8s component artifacts #236

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkg/trivyk8s/trivyk8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ func (c *client) ListArtifacts(ctx context.Context) ([]*artifacts.Artifact, erro
artifactList = append(artifactList, artifact)
}
}

bomArtifacts, err := c.ListBomInfo(ctx)
if err != nil {
return nil, err
}
artifactList = append(artifactList, bomArtifacts...)
return artifactList, nil
}

Expand Down Expand Up @@ -224,17 +228,17 @@ func (c *client) ListBomInfo(ctx context.Context) ([]*artifacts.Artifact, error)
if err != nil {
return []*artifacts.Artifact{}, err
}
artifactList = append(artifactList, &artifacts.Artifact{Kind: "PodInfo", Namespace: c.Namespace, Name: c.Name, RawResource: rawResource})
artifactList = append(artifactList, &artifacts.Artifact{Kind: "PodBomInfo", Namespace: c.Namespace, Name: c.Name, RawResource: rawResource})
}
for _, ni := range b.NodesInfo {
rawResource, err := rawResource(&ni)
if err != nil {
return []*artifacts.Artifact{}, err
}
artifactList = append(artifactList, &artifacts.Artifact{Kind: "NodeInfo", Name: ni.NodeName, RawResource: rawResource})
artifactList = append(artifactList, &artifacts.Artifact{Kind: "NodeBomInfo", Name: ni.NodeName, RawResource: rawResource})
}
cr, err := rawResource(&bom.Result{ID: b.ID, Type: "ClusterInfo", Version: b.Version, Properties: b.Properties})
artifactList = append(artifactList, &artifacts.Artifact{Kind: "ClusterInfo", Name: b.ID, RawResource: cr})
artifactList = append(artifactList, &artifacts.Artifact{Kind: "ClusterBomInfo", Name: b.ID, RawResource: cr})
return artifactList, err

}
Expand Down
Loading