I have Jenkins controller with 2 agents configured. When I tried to deploy on any agent I see the following prompt and deployment job stays there for ever.
*[Pipeline] Start of Pipeline * [Pipeline] node
*Still waiting to schedule task *
*‘FlutterNode’ is reserved for jobs with matching label expression * ‘PreProd’ is reserved for jobs with matching label expression
I’m not seeing any error in any logs related to this hang. All nodes systems resources are fine and don’t see any resource hogging issue. I’m wondering what could be this issue and our deployment is blocked now. Is there any limitation on number agents that can be configured on one node and what should be this issue?
There are no limitations
It seems the label expression you’re using in your pipeline is not matching anything what you have configured in your agents
Check what label you use in the node step or when using declarative what you have for agent. If that expression doesn’t match any labels on your agents then they job will wait forever.
I can’t duplicate the problem that you’re describing. As @mawinter69 said:
I configured my Jenkins 2.452 agent named “linux-agent” with the setting “Only build jobs with label expressions matching this node”. I assigned an additional label “amd64-Ubuntu-22.04” and then ran a Pipeline job that used the label “linux-agent” and a Pipeline job that used the label " amd64-Ubuntu-22.04". Both jobs completed as expected.
On older Jenkins versions, sometimes I needed to configure the agent, change the agent labels, and save the configuration in order to assure that the label was visible. You might try that as a possible work around until you are able to upgrade to the most recent Jenkins LTS.
Thanks for your answers. I don’t know how to fix those security vulnerabilities but I will try to fix them. Coming back nodes configuration I am using these 3 as shown in this snap
When I tried to deploy on one node the other two nodes prompted in the console messages. That means when I tried to deploy on Built-in Node, I see following message:
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
‘FlutterNode’ is reserved for jobs with matching label expression
‘PreProd’ is reserved for jobs with matching label expression
I’m not sure what I’m missing. Let me fix the security errors and see if it helps.
You need to assign the “DevNode” label to one or more of the existing agents. You need to assign the “PreProd” label to one or more of the existing agents.
Upgrading Jenkins won’t change the assignment of labels to agents. That’s something you need to do from the agent configuration page of each agent.
Please see these snapshots from all of agents page and I don’t see labels that you have in your snap, but I do see labels in each node configure screen:
The agent name is always also a label, so technically you don’t need to repeat the agent name as a label, though it shouldn’t hurt. But also when I do this, I have no problem executing pipeline jobs.
Please also check what you have configured as usage, from the logs you showed I assume it is Only build jobs with label expressions matching this node
I can only speculate that something with your pipeline is wrong.
Can you post the snippet again. Please put the snippet in triple single backticks so that it is properly formatted as code
--------------and for Built-In Node -----------------
#!groovy
node {
try {
stage 'Checkout'
sh 'git status'
sh 'git pull https://xxxxxxxxxxxx'
sh 'git branch'
stage 'Build'
sh 'python3 -m venv rvksiteenv'
sh '. xxxx/bin/activate'
sh '/xxxx/pip install django gunicorn psycopg2-binary'
sh '/xxxx/bin/pip freeze'
sh '/xxxx/pip install -r requirements.txt'
stage 'Test'
sh '/xxxx/python manage.py makemigrations'
sh '/xxxx/python manage.py migrate'
sh '/xxxx/pytest'
stage 'Deploy'
sh 'JENKINS_NODE_COOKIE=dontKillMe nohup /xxxx/python manage.py runserver 0.0.0.0:xxxx &'
sh 'echo "deployment is successfully completed."'
}
catch (err) {
sh 'echo "Build failed :face_with_head_bandage: \n`${env.JOB_NAME}#${env.BUILD_NUMBER}` <${env.BUILD_URL}|Open in Jenkins>"'
throw err
}
}
Note: Pardon me, I adjusted the indexing here to avoid horizontal scrolling when viewing the code and also ignored the quotes.
and deployment on either node hangs with the following console log lines
------------Console log-----------
Started by user [UserX]
Obtained Jenkinsfile from git https://xxxx.git
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
‘FlutterNode’ is reserved for jobs with matching label expression
‘PreProd’ is reserved for jobs with matching label expression
``` <version>2.440.3</version>
and the previous vulnerability errors are cleared, but the deployment result is still the same. I'm not sure what else I could try.
Best Regards,
RK