Derive artifact catalogs from the selected party without changing configuration

This commit is contained in:
2026-11-20 04:33:02 +00:00
parent c3e6245416
commit 6900cad104
23 changed files with 446 additions and 315 deletions

View File

@@ -36,9 +36,7 @@ func NormalizedConfigurationPath(path string) string {
}
// EffectivePipelineSourceRecord identifies one effective logical field and a
// safe source that contributed to it. Generated values intentionally have two
// records: their family declaration and the canonical party that supplied the
// member-specific value.
// safe source that contributed to it.
type EffectivePipelineSourceRecord struct {
Path string
Role string
@@ -102,8 +100,8 @@ func EffectivePipelineValues(cfg *PipelineConfig) ([]EffectivePipelineValueRecor
return projectionValueRecords(projectEffectivePipeline(cfg))
}
// EffectivePipelineSources projects pipeline ownership after defaults and
// optional family expansion. It never includes effective values or raw secret
// EffectivePipelineSources projects pipeline ownership after resolution.
// It never includes effective values or raw secret
// material, only logical paths and source identifiers.
func EffectivePipelineSources(cfg *PipelineConfig, party ResolvedParty) ([]EffectivePipelineSourceRecord, error) {
if cfg == nil {
@@ -121,8 +119,6 @@ func EffectivePipelineSources(cfg *PipelineConfig, party ResolvedParty) ([]Effec
if err != nil {
return nil, err
}
families := ArtifactFamilies(cfg)
partySources := partyCharacterSourceLookup(party)
publishCount := 0
if cfg.Publish != nil {
publishCount = len(cfg.Publish.Outputs)
@@ -132,13 +128,9 @@ func EffectivePipelineSources(cfg *PipelineConfig, party ResolvedParty) ([]Effec
if path == "publish.outputs" {
continue
}
if familyKey, ok := generatedArtifactFamilyForPath(path, families); ok {
records = appendGeneratedArtifactSources(records, path, familyKey, families, owners, partySources)
continue
}
records = appendPipelineOwners(records, path, owners[path], cfg)
}
records = appendPublishOutputSources(records, cfg, families, party, owners)
records = appendPublishOutputSources(records, cfg, owners)
sort.Slice(records, func(left, right int) bool {
if records[left].Path != records[right].Path {
return records[left].Path < records[right].Path
@@ -404,25 +396,12 @@ func appendPipelineOwners(records []EffectivePipelineSourceRecord, path string,
return records
}
func appendPublishOutputSources(records []EffectivePipelineSourceRecord, cfg *PipelineConfig, families ArtifactFamilyCatalog, party ResolvedParty, owners map[string][]string) []EffectivePipelineSourceRecord {
func appendPublishOutputSources(records []EffectivePipelineSourceRecord, cfg *PipelineConfig, owners map[string][]string) []EffectivePipelineSourceRecord {
if cfg == nil || cfg.Publish == nil {
return records
}
generated := make(map[string]string)
for familyKey, family := range families.Families {
if family.Publish == nil || !family.Publish.Enabled {
continue
}
for _, key := range family.Members {
generated["narratio.artifact."+key] = familyKey
}
}
for index, output := range cfg.Publish.Outputs {
for index := range cfg.Publish.Outputs {
path := fmt.Sprintf("publish.outputs[%d]", index)
if familyKey, ok := generated[strings.TrimSpace(output.Source)]; ok {
records = appendGeneratedPublishSources(records, path, familyKey, families, owners, party)
continue
}
records = appendPipelineOwners(records, path, owners["publish.outputs"], cfg)
}
return records