reuseNode in docker-plugin

36 views
Skip to first unread message

Kirk Fitzsimons

unread,
Jan 8, 2025, 8:26:50 AMJan 8
to Jenkins Users
Hi,

Apologies if this has been asked/answered already, but it there an ability to reuse docker nodes between stages using the docker-plugin, I know you can do it using the docker-pipeline

My use case is I have a parent pipeline job, which triggers child pipeline jobs, each child job ends up cloning the same git repo in a stage, this takes too much time, and I would like to somehow persist the workspace/reuse the node.

If this is not possible with the plugin, is there a workaround, perhaps using a volume for the workspace which can be shared across the jobs?

Kirk

Om Naidu

unread,
Jan 8, 2025, 9:15:41 AMJan 8
to jenkins...@googlegroups.com
What type of pipeline project are you using? did you use multi brach pipeline?

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jenkinsci-users/5505e1c6-7e11-4744-94bf-77bb28ddbe56n%40googlegroups.com.

Kirk Fitzsimons

unread,
Jan 8, 2025, 9:27:33 AMJan 8
to Jenkins Users

It is not a multibranch pipeline, It is a declarative pipeline

Kirk Fitzsimons

unread,
Jan 8, 2025, 9:33:51 AMJan 8
to Jenkins Users

This would be an example:

pipeline {

    agent { label 'default' }

    stages{
        stage('Parallel: Job A & Job B){
            parallel {
                stage('A') {
                    steps {
                        build job: 'Job A',
                    } //steps
                }//stage
                stage('B') {
                    steps {
                        build job: 'Job B',
                    } //steps
                }//stage
            }//parallel
        }//stage

    } // stages

} // pipeline


Job A and Job B clone the same repo/branch, I was wondering if I can reuse them somehow...

They dont need can be ran sequentially either, I just want a way of making the cloning of the same repos quicker

Om Naidu

unread,
Jan 8, 2025, 12:39:14 PMJan 8
to jenkins...@googlegroups.com
Try with Multibranch. This may require tweaking your build process or trigger points.

You can also try parallel stages by scripting jenkinsfile properly. 

Reply all
Reply to author
Forward
0 new messages