This commit is contained in:
mr
2026-03-12 09:20:48 +01:00
parent da9a7d3a49
commit e2399c6853
6 changed files with 71 additions and 2 deletions

View File

@@ -16,7 +16,9 @@ import (
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/models/common/enum"
"cloud.o-forge.io/core/oc-lib/models/resources"
"cloud.o-forge.io/core/oc-lib/models/workflow"
w "cloud.o-forge.io/core/oc-lib/models/workflow"
"cloud.o-forge.io/core/oc-lib/models/workflow/graph"
"github.com/nwtgck/go-fakelish"
"github.com/rs/zerolog"
"gopkg.in/yaml.v3"
@@ -178,6 +180,27 @@ func (b *ArgoBuilder) createTemplates(namespace string) ([]string, []string, []V
return firstItems, lastItems, volumes
}
func (b *ArgoBuilder) GetByRelatedProcessing(w *workflow.Workflow, processingID string, g func(item graph.GraphItem) bool) []string {
related := []string{}
for _, link := range w.Graph.Links {
nodeID := link.Destination.ID
var node resources.ResourceInterface
if g(w.Graph.Items[link.Source.ID]) {
item := w.Graph.Items[link.Source.ID]
_, node = item.GetResource()
}
if node == nil && g(w.Graph.Items[link.Destination.ID]) { // if the source is not a storage, we consider that the destination is the storage
nodeID = link.Source.ID
item := w.Graph.Items[link.Destination.ID] // and the processing is the source
_, node = item.GetResource() // we are looking for the storage as destination
}
if processingID == nodeID && node != nil { // if the storage is linked to the processing
related = append(related, node.GetID())
}
}
return related
}
func (b *ArgoBuilder) createArgoTemplates(namespace string,
id string,
processing *resources.ProcessingResource,