wl2776
wl2776

Reputation: 4327

Jenkins pipeline job always tries to start on master

I've restricted builds that my Jenkins master executes, since all its slaves are more powerful than it, in Node security settings.

I mean: "Manage Jenkins" -> "Manage nodes" -> master -> "Configure" -> check "Restrict jobs that run on this node" -> "Job restriction" -> "Regular expression". Then enter regexp like ^exact_allowed_job_name$.

Now a pipeline job is stuck in the pending state ("Waiting for next available executor on master").

I cannot find any means to specify a slave that should execute this job in job settings, like the "Restrict where this project can be run" checkbox in freestyle jobs.

Is it possible?

Specifying labels doesn't help. It was the first that I've tried.

This simple pipeline anyway wants the master, regardless 'special' label.

#!/usr/bin/env groovy

node('special') {
   stage('checkout') {
       echo 'checkout'
   }
}

This pipeline is stuck too.

#!/usr/bin/env groovy

pipeline {
    agent none
    stages {
        stage('Checkout'){
            agent {
                label 'special'
            }
            steps {
                echo 'Checkout'
            }
        }
    }
}

Upvotes: 4

Views: 8074

Answers (1)

wl2776
wl2776

Reputation: 4327

Thanks, @Quantic for pointing to the documentation.

According to it,

every Pipeline build itself runs on the master, using a flyweight executor — an uncounted slot that is assumed to not take any significant computational power.

Since I've set, that job names must match the regexp, which in my case is the exact name of the single allowed job, I've effectively disabled all Pipeline scripts.

Moreover, it is a known bug: https://issues.jenkins-ci.org/browse/JENKINS-31866

The priority of this bug is low, therefore Pipeline plugin is not an option for me.

Upvotes: 1

Related Questions