Unable to run Pipeline on Jenkins agent

368 Views Asked by At

I am experiencing difficulties running a pipeline on a Jenkins agent. The Jenkins agent is connected to the Jenkins Controller through JNLP.

In the Jenkins Controller WebGUI, I can confirm that the agent is successfully launched and running. I have created a pipeline and specified the agent on which it should run, as shown below:

pipeline {
  agent {        
    label 'TestAgent'        
  }
    
  stages {
    stage('Retrieve Source Code') {
      steps {
        //steps
      }
    }

I have verified the agent configuration, pipeline configuration, and the connection between the agent and controller, and everything seems to be in order.

When I run the pipeline with the 'Built-In-Node' option turned on, the pipeline builds successfully. However, when I turn off 'Built-In-Node' and attempt to run the pipeline with the specified agent, it fails to build. The status shows "Build Scheduled," but no progress is made.

Furthermore, upon checking the Task Manager on the agent's PC, I see no Jenkins-related processes running. I have examined the Agent Log in Jenkins, but there are no relevant entries but in the system Logs, when I run the pipeline I see that the pipeline job is trying to run in Built-In-Node even after defining which node the pipeline should run on.

Also below have attached the images of the node configuration from the WebGUI

enter image description here enter image description here enter image description here

The Jenkins Version is 2.401.2 LTS.

Below given are the plugins used

enter image description here enter image description here

This is the time difference between controller and agent PC's I notice. Could that have any impact enter image description here

Are there any additional configurations I need to set up? Could someone provide guidance on how to troubleshoot this issue?

It's worth noting that both the Jenkins controller and Jenkins agent are running on Windows PCs.

1

There are 1 best solutions below

4
duemir On

The first thing that stands out from your data is that your agent's name is TestAgent, and it has no labels. Yet your example pipeline definition targets Gen2 label. In this specific example when the pipeline requests a node your agent doesn't match so the pipeline build keeps waiting.

Note that the Pipeline definition is always evaluated on the controller. You might see it on the built-in node on the unnumbered (lightweight) executor for short periods of time.