From 5f763dc3868aa471c47883fa8c8a2eac6861ec5a Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 28 Jun 2022 18:22:32 +0100 Subject: [PATCH] manifest: ensure uniqueness of pipeline names Panic in case two pipelines with the same name are added to the manifest. In the future we should deal with allocating fresh names, but that is not yet needed. --- internal/manifest/manifest.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/manifest/manifest.go b/internal/manifest/manifest.go index 6eb55a457..8af3dc88f 100644 --- a/internal/manifest/manifest.go +++ b/internal/manifest/manifest.go @@ -35,7 +35,11 @@ func New() Manifest { } func (m *Manifest) AddPipeline(p Pipeline) { - // TODO: enforce uniqueness - pipelines should have a back pointer to the manifest + for _, pipeline := range m.pipelines { + if pipeline.Name() == p.Name() { + panic("duplicate pipeline name in manifest") + } + } m.pipelines = append(m.pipelines, p) m.addPackages(p.getPackages()) m.addOSTreeCommits(p.getOSTreeCommits())