Skip to content

Commit e3a7f90

Browse files
committed
feat: add releasechannel ignore label
1 parent 2f16992 commit e3a7f90

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

internal/ocm/ocm.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"os"
88
"strings"
99

10+
"log"
11+
1012
corev1 "k8s.io/api/core/v1"
1113
"ocm.software/ocm/api/ocm"
1214
"ocm.software/ocm/api/ocm/extensions/accessmethods/helm"
@@ -134,13 +136,28 @@ func GetOCMComponentsWithVersions(repo ocm.Repository, components []string, pref
134136
Versions: make([]v1beta1.ComponentVersion, 0),
135137
}
136138

139+
outer:
137140
for _, version := range versions {
138141
cva, err := component.LookupVersion(version)
139142
if err != nil {
140143
return nil, err
141144
}
142145

146+
if len(cva.GetDescriptor().Labels) > 0 {
147+
for _, label := range cva.GetDescriptor().Labels {
148+
valStr := strings.Trim(string(label.Value), "\"")
149+
if (label.Name == "openmcp.cloud/ignore") && valStr == "true" {
150+
continue outer
151+
}
152+
}
153+
}
154+
143155
resources := cva.GetResources()
156+
if len(resources) == 0 {
157+
log.Printf("Error: component version %s of %s does not have any resources\n", version, componentName)
158+
continue // We skip releasechannel component versions which dont have any resources
159+
}
160+
144161
access, err := resources[0].Access()
145162
if err != nil {
146163
return nil, err

0 commit comments

Comments
 (0)