Do multibranch jobs lead to code duplication?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Do multibranch jobs lead to code duplication?

Martin Schmude
Dear all,

if I understand multibranch jobs right, then a Jenkinsfile in branch "master" will be replicated into all other branches drawn from "master".
It has to be like that because the Jenkinsfile is the "marker" that tells Jenkins to build a branch, and how to do that. Branches without a Jenkinsfile will not be built.

This will often result in code duplication, with all the well-known issues.
If a small change has to be made to the Jenkinsfile, it has to be applied to all branches.

How do you handle that issue? Is there a recommended practice?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4ceb91fb-e271-4b1f-9026-5154d31e5823o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Do multibranch jobs lead to code duplication?

jeremy mordkoff
How do you normally handle branches and merging? I use the same tools and branching and merging rules as the rest of the team, i.e. development and QA. 

In our case, the teams are required to merge from master to their project branches on a regular basis, so they will eventually get my changes that I make in master.



On Tuesday, July 21, 2020 at 5:37:39 PM UTC-4, Martin Schmude wrote:
Dear all,

if I understand multibranch jobs right, then a Jenkinsfile in branch "master" will be replicated into all other branches drawn from "master".
It has to be like that because the Jenkinsfile is the "marker" that tells Jenkins to build a branch, and how to do that. Branches without a Jenkinsfile will not be built.

This will often result in code duplication, with all the well-known issues.
If a small change has to be made to the Jenkinsfile, it has to be applied to all branches.

How do you handle that issue? Is there a recommended practice?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/26c8d410-37d8-4de5-8b7b-1b8bdeab9baao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Do multibranch jobs lead to code duplication?

Nick_S
In reply to this post by Martin Schmude
We use the Jenkins pipeline as a library so our Jenkinsfile is as short as:

@Library('Jenkins-pipeline@master')_
def pipelineParams = [
    agent: 'Linux',
    slackChannel: 'build-dev'
]
mavenJavaPipeline pipelineParams

And the real pipeline code is in a separate repository. If you want to change the pipeline you can use a project and change the branch of the pipeline (master -> featurebranch) to test the changes in the library before merging the pipeline changes back to master (effectively adjusting all the builds that use the pipeline).

With regards,

Nick Stolwijk

~~~ Try to leave this world a little better than you found it and, when your turn comes to die, you can die happy in feeling that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Tue, Jul 21, 2020 at 11:37 PM 'Martin Schmude' via Jenkins Users <[hidden email]> wrote:
Dear all,

if I understand multibranch jobs right, then a Jenkinsfile in branch "master" will be replicated into all other branches drawn from "master".
It has to be like that because the Jenkinsfile is the "marker" that tells Jenkins to build a branch, and how to do that. Branches without a Jenkinsfile will not be built.

This will often result in code duplication, with all the well-known issues.
If a small change has to be made to the Jenkinsfile, it has to be applied to all branches.

How do you handle that issue? Is there a recommended practice?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4ceb91fb-e271-4b1f-9026-5154d31e5823o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA9S6i526aq3zrPJSOt6aMTXQXexmmn-A2rx2B5cnWNy%2Bb5E4Q%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Do multibranch jobs lead to code duplication?

Dirk Heinrichs-3
In reply to this post by Martin Schmude
Am Dienstag, den 21.07.2020, 14:37 -0700 schrieb 'Martin Schmude' via Jenkins Users:

If a small change has to be made to the Jenkinsfile, it has to be applied to all branches.

That's true for all code changes which are needed in multiple branches, isn't it? That's called back-/forward porting. It allows your Jenkins job to evolve together with your main code.

HTH...

Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/09508c1895f9e6c6ef278e719d267476f49e39e9.camel%40opentext.com.

signature.asc (235 bytes) Download Attachment