Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchestration Pipeline: Duplicate class error in Jenkinsfile #1079

Open
renedupont opened this issue Mar 15, 2024 · 0 comments
Open

Orchestration Pipeline: Duplicate class error in Jenkinsfile #1079

renedupont opened this issue Mar 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@renedupont
Copy link
Member

renedupont commented Mar 15, 2024

Describe the bug
I have two components that I wanted to release via the release manager / orchestration pipeline. In both components I had in each Jenkinsfile this:

class DatabaseConnection {
    String database
    String username
    String password
}
def dbConnection = new DatabaseConnection(database: 'postgres', username: 'postgres', password: 'secret')

Once I ran the release manager, I got a duplicate class exception and the pipeline failed because of this.

Meanwhile I fixed it by removing the above class and using a map instead in one of the components. Unfortunately the jenkins job that displayed the error was meanwhile automatically deleted so I don't have the exact exception text anymore but it was something like:
Duplicate class definition for class 'DatabaseConnection'.

Again, in my case I solved it because it was easy to convert the class into a map, but in case you want to use a more complex class in several components, it is not possible to run the release manager with it. A workaround would be to name the class in each component differently or add package paths but I don't think that is a valid final solution to it.

Update:
@oalyman told me the reason on why this is happening:
The Groovy code written in a Jenkinsfile runs on the Jenkins controller (master) by default, not on the agents. This means that any Groovy code specified in a Jenkinsfile will be executed on the controller where Jenkins is running, rather than on the agents.

So I am not sure whether there is an easy fix since it is rather an issue happening due to the architecture of Jenkins and the Orchestration Pipeline.

@renedupont renedupont added the bug Something isn't working label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant