Skip to content

Commit

Permalink
use lib manifest types
Browse files Browse the repository at this point in the history
  • Loading branch information
refaelm92 committed Jun 4, 2024
1 parent 26284fe commit 37e55a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 39 deletions.
16 changes: 5 additions & 11 deletions adapters/v1/domain_to_armo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v1

import (
"context"
"encoding/base64"
"encoding/json"
"strings"

Expand Down Expand Up @@ -223,26 +222,21 @@ func parseImageManifest(sbom domain.SBOM) (*containerscan.ImageManifest, error)
if sbom.Content == nil {
return nil, nil
}

var rawManifest domain.RawImageManifest
var rawManifest source.ImageMetadata
if err := json.Unmarshal(sbom.Content.SyftSource.Metadata, &rawManifest); err != nil {
return nil, err
}

configData, err := base64.StdEncoding.DecodeString(rawManifest.Config)
var config v1.ConfigFile
err := json.Unmarshal(rawManifest.RawConfig, &config)
if err != nil {
return nil, err
}

var config domain.ImageConfig
if err := json.Unmarshal(configData, &config); err != nil {
return nil, err
}

imageManifest := containerscan.ImageManifest{
Architecture: config.Architecture,
OS: config.OS,
Size: rawManifest.ImageSize,
Size: rawManifest.Size,
Layers: []containerscan.ESLayer{},
}

Expand All @@ -251,7 +245,7 @@ func parseImageManifest(sbom domain.SBOM) (*containerscan.ImageManifest, error)
layerInfo := containerscan.ESLayer{
LayerInfo: &containerscan.LayerInfo{
CreatedBy: historyLayer.CreatedBy,
CreatedTime: &historyLayer.Created,
CreatedTime: &historyLayer.Created.Time,
LayerOrder: i,
},
}
Expand Down
28 changes: 0 additions & 28 deletions core/domain/image.go

This file was deleted.

0 comments on commit 37e55a9

Please sign in to comment.