(stageFiles []Stagefile, pctx *UnixParserCtx, ectx EnricherCtx)
| 37 | } |
| 38 | |
| 39 | func LoadStages(stageFiles []Stagefile, pctx *UnixParserCtx, ectx EnricherCtx) ([]Node, error) { |
| 40 | var allNodes []Node |
| 41 | |
| 42 | tmpStages := make(map[string]bool) |
| 43 | pctx.Stages = []string{} |
| 44 | |
| 45 | for _, sf := range stageFiles { |
| 46 | nodes, err := processStageFile(sf, pctx, ectx) |
| 47 | if err != nil { |
| 48 | return nil, err |
| 49 | } |
| 50 | |
| 51 | for _, n := range nodes { //nolint:gocritic // rangeValCopy |
| 52 | allNodes = append(allNodes, n) |
| 53 | tmpStages[n.Stage] = true |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | for k := range tmpStages { |
| 58 | pctx.Stages = append(pctx.Stages, k) |
| 59 | } |
| 60 | |
| 61 | sort.Strings(pctx.Stages) |
| 62 | log.Infof("Loaded %d nodes from %d stages", len(allNodes), len(pctx.Stages)) |
| 63 | |
| 64 | return allNodes, nil |
| 65 | } |
| 66 | |
| 67 | func processStageFile(stageFile Stagefile, pctx *UnixParserCtx, ectx EnricherCtx) ([]Node, error) { |
| 68 | if !strings.HasSuffix(stageFile.Filename, ".yaml") && !strings.HasSuffix(stageFile.Filename, ".yml") { |
searching dependent graphs…