loadIncludeConfig parse the required config from raw yaml
(source any)
| 32 | |
| 33 | // loadIncludeConfig parse the required config from raw yaml |
| 34 | func loadIncludeConfig(source any) ([]types.IncludeConfig, error) { |
| 35 | if source == nil { |
| 36 | return nil, nil |
| 37 | } |
| 38 | configs, ok := source.([]any) |
| 39 | if !ok { |
| 40 | return nil, fmt.Errorf("`include` must be a list, got %s", source) |
| 41 | } |
| 42 | for i, config := range configs { |
| 43 | if v, ok := config.(string); ok { |
| 44 | configs[i] = map[string]any{ |
| 45 | "path": v, |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | var requires []types.IncludeConfig |
| 50 | err := Transform(source, &requires) |
| 51 | return requires, err |
| 52 | } |
| 53 | |
| 54 | func ApplyInclude(ctx context.Context, workingDir string, environment types.Mapping, model map[string]any, options *Options, included []string, processor PostProcessor) error { |
| 55 | includeConfig, err := loadIncludeConfig(model["include"]) |
no test coverage detected
searching dependent graphs…