Skip to content

Commit

Permalink
Fix catalog duplicate builder traits
Browse files Browse the repository at this point in the history
  • Loading branch information
kajogo777 committed Feb 27, 2023
1 parent f9eec3a commit 2a7353a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,22 @@ func Publish(gitDir string, configDir string, server auth.ServerConfig) error {

builderMeta := metadata.LookupPath(cue.ParsePath("builder"))
if builderMeta.Exists() {
traits := []string{}
traitsMap := map[string]interface{}{}

flows := item.LookupPath(cue.ParsePath("flows"))
flowIter, _ := flows.Fields()
for flowIter.Next() {
traitIter, _ := flowIter.Value().LookupPath(cue.ParsePath("match.traits")).Fields()
for traitIter.Next() {
traits = append(traits, traitIter.Label())
traitsMap[traitIter.Label()] = nil
}
}

traits := []string{}
for trait := range traitsMap {
traits = append(traits, trait)
}

data, _ := format.Node(item.Source())
catalogItem := CatalogItem{
Module: module,
Expand Down

0 comments on commit 2a7353a

Please sign in to comment.