neil201
neil201

Reputation: 33

Jenkins Pipeline Downstream Jobs - continue with next job at specific stage

Background

We have multiple declarative pipeline jobs that can be selected and built in order as downstream jobs from a Master pipeline job. This will wait for each triggered job to complete before starting the next one inline.

Each of the downstream jobs has an input stage where it will wait for user input for artifact promotion before continuing on.

The Problem

Is it possible to have the Master Job continue and start the next job in line once the current job hits the input stage? i.e. not to wait for the user input before starting the next job inline

From what I see the only options here are wait: true/false AND quietPeriod: to put in a delay. The example below shows these options but neither are suitable for our scenario.

build (job: 'myJob1', parameters: [booleanParam (name: 'startServer', value: false)], quietPeriod: 10, wait: true)
build (job: 'myJob2', parameters: [booleanParam (name: 'startServer', value: false)], quietPeriod: 10, wait: true)

Upvotes: 0

Views: 1037

Answers (1)

3sky
3sky

Reputation: 890

Checkout Parallel Stages, it's exactly what you're looking for.

parallel one: {
    stage ('Starting Test') 
    {
        build (job: 'myJob1', parameters: [booleanParam (name: 'startServer', value: false)], quietPeriod: 60, wait: false)
    }
}, two: {
    stage ('Starting Test2') 
    {
        build (job: 'myJob2', parameters: [booleanParam (name: 'startServer', value: false)], quietPeriod: 60, wait: false)
    }
}

Upvotes: 0

Related Questions