jenkinsjenkins-groovyjenkins-job-dsl

Jenkins jobs are getting combined for identical jobs


Image of my issue: https://i.sstatic.net/mKzcc.png

I am trying to trigger same pipeline through jenkins config multiple times, I want it to that that many jobs to get placed in the waiting queue and run each and every one of the same job one by one.

currently as you can see its getting merged into 1 job and only that job is running (single time).

how can I make it run each and every job, and prevent the combining feature?

even if I try to click build button manually multiple time then also it does the same, combines them into one.

my config is as follows:


pipeline {
    agent any


    stages {
        stage("first") {
            steps {
                sleep(20)
            }
        }
        stage('Hello') {
            steps {
                
                
                build job: 'queue', wait: false
                sleep(10)
                
                build job: 'queue', wait: false
                sleep(10)
                
                build job: 'queue', wait: false
            }
        }
    }
}

Note: I am not running jobs in parallel, they are sequencial


Solution

  • If all the jobs are similar and have no parameters/same parameters, Jenkins will only execute one of them. This is the default behavior required by most people since they don't want the exact same job to run multiple times. There is a minor issue opened for this, but it is unresolved.

    What you can do is introduce a parameter. The parameter won't be used anywhere, but will only exist for the purposes of distinguishing one build from the other. If you run each build with a different parameter value, multiple builds will run.