Skip to content

Commit

Permalink
Modified containerd snapshot extractor to make it work on VM's disk s…
Browse files Browse the repository at this point in the history
…napshots.

PiperOrigin-RevId: 682971067
  • Loading branch information
slowest-sloth authored and copybara-github committed Oct 6, 2024
1 parent 2174516 commit 225efe1
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 89 deletions.
5 changes: 5 additions & 0 deletions binary/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ func setProtoMetadata(meta any, i *spb.Inventory) {
ImageDigest: m.ImageDigest,
Runtime: m.Runtime,
InitProcessPid: int32(m.InitProcessPID),
Snapshotter: m.Snapshotter,
SnapshotKey: m.SnapshotKey,
LowerDir: m.LowerDir,
UpperDir: m.UpperDir,
WorkDir: m.WorkDir,
},
}
case *ctrdruntime.Metadata:
Expand Down
10 changes: 10 additions & 0 deletions binary/proto/proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ func TestScanResultToProto(t *testing.T) {
ImageDigest: "sha256:b1455e1c4fcc5ea1023c9e3b584cd84b64eb920e332feff690a2829696e379e7",
Runtime: "io.containerd.runc.v2",
InitProcessPID: 8915,
Snapshotter: "overlayfs",
SnapshotKey: "abcweraweroiuojgawer1",
LowerDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/1/fs",
UpperDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/fs",
WorkDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/work",
},
Locations: []string{"/file4"},
Extractor: &ctrdfs.Extractor{},
Expand All @@ -470,6 +475,11 @@ func TestScanResultToProto(t *testing.T) {
ImageDigest: "sha256:b1455e1c4fcc5ea1023c9e3b584cd84b64eb920e332feff690a2829696e379e7",
Runtime: "io.containerd.runc.v2",
InitProcessPid: 8915,
Snapshotter: "overlayfs",
SnapshotKey: "abcweraweroiuojgawer1",
LowerDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/1/fs",
UpperDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/fs",
WorkDir: "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/work",
},
},
Locations: []string{"/file4"},
Expand Down
5 changes: 5 additions & 0 deletions binary/proto/scan_result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ message ContainerdContainerMetadata {
string image_digest = 3;
string runtime = 4;
int32 init_process_pid = 5;
string snapshotter = 6;
string snapshot_key = 7;
string lower_dir = 8;
string upper_dir = 9;
string work_dir = 10;
}

message ContainerdRuntimeContainerMetadata {
Expand Down
10 changes: 8 additions & 2 deletions binary/proto/scan_result_go_proto/scan_result.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 225efe1

Please sign in to comment.