Run a Pipeline on the Jenkins Controller’s Built-in Node
If you find yourself in a situation where you have a Jenkins setup composed of the controller and one or more agents, you will notice that the agents will be used for building the jobs — which is actually what we want.
However, there can be situations where you might want to do this.
I found the official Jenkins documentation [1] on this particular topic to be a bit confusing. While it talks about using labels to select a specific agent, it does not mention anything about running pipelines on the controller.
A quick look at the available nodes will reveal that the built-in node does not have a label visible.
However, the approach I’ve found to be working is by specifying the label built-in
as shown in the example below:
pipeline {
agent { label 'built-in' }
stages {
stage ('Test') {
steps {
sh """
echo "Test"
"""
}
}
}
post {
always {
cleanWs()
}
}
}
As you can observe from the execution logs, this pipeline was then executed on the built-in node.