Skip to content

Commit

Permalink
fix(oci): Add filtering capability to package manager (#803)
Browse files Browse the repository at this point in the history
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
  • Loading branch information
craciunoiuc committed Sep 14, 2023
2 parents b139ae2 + 87cd065 commit c87b21b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion oci/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"kraftkit.sh/oci/handler"
"kraftkit.sh/pack"
"kraftkit.sh/packmanager"
"kraftkit.sh/unikraft"
"kraftkit.sh/unikraft/component"
"kraftkit.sh/unikraft/target"
)
Expand Down Expand Up @@ -123,7 +124,7 @@ func (manager *ociManager) Catalog(ctx context.Context, qopts ...packmanager.Que
query := packmanager.NewQuery(qopts...)
qname := query.Name()
qversion := query.Version()

types := query.Types()
// Adjust for the version being suffixed in a prototypical OCI reference
// format
ref, refErr := name.ParseReference(qname,
Expand Down Expand Up @@ -223,6 +224,18 @@ func (manager *ociManager) Catalog(ctx context.Context, qopts ...packmanager.Que
}

for _, manifest := range manifests {
if len(types) > 0 {
found := false
for _, t := range types {
if unikraft.ComponentTypeApp == t {
found = true
break
}
}
if !found {
continue
}
}
// Check if the OCI image has a known annotation which identifies if a
// unikernel is contained within
if _, ok := manifest.Annotations[AnnotationKernelVersion]; !ok {
Expand Down

0 comments on commit c87b21b

Please sign in to comment.