jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.43k stars 613 forks source link

GitLabConnectionConfig.does not check if Gitlab Connection is unique #1670

Open arturrekawek opened 1 month ago

arturrekawek commented 1 month ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

https://javadoc.jenkins.io/plugin/gitlab-plugin/com/dabsquared/gitlabjenkins/connection/GitLabConnectionConfig.html#addConnection(com.dabsquared.gitlabjenkins.connection.GitLabConnection)

Any Jenkins LTS version

Reproduction steps

run few times with Groovy gitLabConnectionConfig.addConnection(newConnection) it does not check if newConnection is unique

Expected Results

this function should work as https://javadoc.jenkins.io/plugin/gitlab-branch-source/io/jenkins/plugins/gitlabserverconfig/servers/GitLabServers.html#addServer(io.jenkins.plugins.gitlabserverconfig.servers.GitLabServer)

Actual Results

Currently you can create multeiple connection with same id (name) It is not acceptable

Anything else?

No

Are you interested in contributing a fix?

Currently no