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.
This commit is contained in:
Tom Gundersen 2022-06-28 18:22:32 +01:00
parent f791bde0e4
commit 5f763dc386

View file

@ -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())