Skip to content

When a component with the same name is added, an error is returned, but the component is still added #622

@whytrall

Description

@whytrall

/kind bug

Which area this bug is related to?

/area library

What versions of software are you using?

Go Pkg Version: 1.1.0

Bug Summary

Describe the bug:
An error is returned when adding a component with the same name as existing one, but a new component is still added, despite the error. I asked on Gitter and Elson said that this is not an intended behavior.

To Reproduce:
Execute this piece of code twice

devfile.AddComponents([]v1alpha2.Component{
	{
		Name: "TestComp",
		ComponentUnion: v1alpha2.ComponentUnion{
			Container: &v1alpha2.ContainerComponent{
				Container: v1alpha2.Container{
					Image:       "test",
					MemoryLimit: "3Gb",
				},
			},
		},
	},
})

Expected behavior

An error is returned and a component is not added the second time

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable.

Additional context

Any workaround?
Right now in our code we check if a component with same name exist. If it does, we do not add it again.

Metadata

Metadata

Assignees

Labels

area/libraryCommon devfile library for interacting with devfileskind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions