@@ -17,6 +17,7 @@ import (
1717 "ocm.software/ocm/api/tech/oci/identity"
1818 "ocm.software/ocm/api/utils/accessobj"
1919 "sigs.k8s.io/controller-runtime/pkg/client"
20+ "sigs.k8s.io/controller-runtime/pkg/log"
2021
2122 "github.com/openmcp-project/control-plane-operator/api/v1beta1"
2223)
@@ -119,7 +120,9 @@ func GetOCMLocalRepo(ocmRegistry []byte, prefixFilter string) (ocm.Repository, [
119120//
120121// The prefixFilter must be specified as it will be cut off every componentName in the end
121122// so the resulting Component names are without it.
122- func GetOCMComponentsWithVersions (repo ocm.Repository , components []string , prefixFilter string ) ([]v1beta1.Component , error ) {
123+ func GetOCMComponentsWithVersions (ctx context.Context , repo ocm.Repository , components []string , prefixFilter string ) ([]v1beta1.Component , error ) {
124+ log := log .FromContext (ctx )
125+
123126 octx := ocm .DefaultContext ()
124127
125128 var componentList = make ([]v1beta1.Component , 0 , len (components ))
@@ -134,13 +137,28 @@ func GetOCMComponentsWithVersions(repo ocm.Repository, components []string, pref
134137 Versions : make ([]v1beta1.ComponentVersion , 0 ),
135138 }
136139
140+ outer:
137141 for _ , version := range versions {
138142 cva , err := component .LookupVersion (version )
139143 if err != nil {
140144 return nil , err
141145 }
142146
147+ if len (cva .GetDescriptor ().Labels ) > 0 {
148+ for _ , label := range cva .GetDescriptor ().Labels {
149+ valStr := strings .Trim (string (label .Value ), "\" " )
150+ if (label .Name == "openmcp.cloud/ignore" ) && valStr == "true" {
151+ continue outer
152+ }
153+ }
154+ }
155+
143156 resources := cva .GetResources ()
157+ if len (resources ) == 0 {
158+ log .Info ("Skipping component version %s of %s: no resources found\n " , version , componentName )
159+ continue // We skip releasechannel component versions which dont have any resources
160+ }
161+
144162 access , err := resources [0 ].Access ()
145163 if err != nil {
146164 return nil , err
0 commit comments