I have a problem with Jenkins build and this is what I am seeing in the build log:
[Pipeline] Start of Pipeline
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Still waiting to schedule task
‘Jenkins’ doesn’t have label ‘ci’
I am not sure what does that actually means.
I have tried to check the configuration under "Configure Clouds" in Jenkins and it looks like this:
I would suggest few changes do it like this
Keep everything blank for jenkins tunnel. Jenkins will automatically will pick it up.
If you deployed this jenkins instance in kubernetes cluster then please use internal address for jenkins_url like http://jenkins.infrastructure.svc i assume your jenkins service name is jenkins and it is ClusterIP
For Pod template you can just use name and labels and remove container template section. kubernetes will pick it up default.
Please use the same label to schedule job as agent means you gave the label name different and using as diffrent means your jenkins looking for ci agent which is not present so you should replace with jenkins-jenkins-slave in your pipeline
Related
Still waiting to schedule task
‘docker’ is offline
JenkinsFile:
pipeline {
agent {
node {
label 'docker'
customWorkspace "workspace/${JOB_NAME}/${BUILD_NUMBER}"
}
}
...
What is the cause of this error, and how can I diagnose it further?
I don't see any related containers running via docker ps.
Relating to the agent named docker. They can be viewed on the "Build executor status" / "Nodes" / https://jenkins-url.local/computer/
If you use node {} with a specific label, and don't have any nodes with that label set-up, the build will be stuck forever. You also need to make sure you have at least 2 executors set-up when using a single node (like 'master'), otherwise pipeline builds will usually be stuck, as they consist of a root build and several sub-builds for the steps.
My goal is to set up a declarative pipeline job which automatically triggers the vSphere plugin to create a VM on which the build and test runs in a clean environment.
I've configured the vSphere Cloud Plugin in Jenkins' global settings to build slaves with label "appliance-slave", and this does trigger for freestyle jobs with "Restrict where this project can be run" set to that label. However, the following example pipeline never triggers the vSphere plugin (based on tailing the Jenkins log):
pipeline {
agent {
label 'appliance-slave'
}
stages {
stage('Test') {
steps {
sh "hostname && hostname -i"
}
}
}
}
I've searched the documentation without any luck. Is there some configuration option or alternate agent declaration that I'm missing that would allow this?
Finally resolved the problem; the issue was that I needed to go in to the actual slave configuration and set up the slave there. The vSphere plugin modifies the slave configuration page to allow exactly what I was trying to do: shutting down and reverting the VM once the build is complete.
I am trying to use jenkins. But when I reading the Declarative Pipeline Syntax, I confused by the agent term
https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline
What does the agent stand for?
Is that mean I can set the pipeline runtime folder path?
How to create an agent?
How set a label for agent?
I can feel you :-D.
Here are the answers:
The agent section specifies where the entire Pipeline, or a specific stage, will execute in the Jenkins environment depending on where the agent section is placed. The section must be defined at the top-level inside the pipeline block, but stage-level usage is optional. - Content copied from the agent section
NO, this has nothing to do with the pipeline runtime folder path.
You can for example Create an agent/node by the following tutorial:
How to Setup Jenkins Agent/Slave Using Password and ssh Keys. -
But there are many other ways to create an agent e.g. using a Docker-Container (...).
You can Set a label under the Configuration of the Node.
You can use a label in your pipeline like:
pipeline {
agent { label 'labelName' }
(...)
}
While #adbo covered questions asked, Jenkins glossary describes agent really well:
typically a machine, or container, which connects to a Jenkins controller and executes tasks when directed by the controller.
You can choose to run entire pipeline on any available agent (agent any at the top of the pipeline) or run a specific stage on the agent of choice e.g. run build stage in a specific environ by overriding agent in that stage:
agent { docker { image 'my image' } }
I have a Jenkins instance where I am not able to use labels, builds are triggered but get stuck at "pending—master is offline". I have disabled the master (executor # : 0) as I do not wish to use it.
Instead I would expect the build to go to the next available node with the label mentioned in the pipeline.
node("mylabel"){
echo " jenkins pipeline for mylabel nodes"
}
This works in a clean install of jenkins so I can only assume this is a configuration/compatibility issue on my master instance.
Could it be a permission issue?
more info about my master instance :
I have used in the past the nodeLabel (with freestyle jobs) and have removed it (and removed all extra instructions in my jobs once removed via the management view).
I am using the Role-based Authorization Strategy and have defined roles for each projects in jenkins.
Note that I am behind a firewall (no internet access during execution) using Jenkins 2.73.2
EDIT 1:
another syntax - same issue observed.
pipeline {
agent{
label "mylabel"
echo " jenkins pipeline for mylabel node"
}
}
I found the issue occurred because I am not able to bypass the master node using the above pipeline. I understand that before the label selection there is a need for a default node to be available to run instructions.
I can't get Jenkins labels to work in Jenkins while using pipelines.
My node is defined with a label say "poolA", and the following pipeline should attempt to run on that node but it doesn't.
Any ideas why?
Console says:
MyAgentis reserved for jobs with matching label expression; Jenkins
is reserved for jobs with matching label expression
This is my pipeline:
node{
label 'poolA'
echo " jenkins pipeline for rapidx node"
}
My node is defined as follows:
Only build job with label expression ....
Launch method : Java webstart
Avail : Keep this agent online as much as possible
Executors # : 1
Other settings unchanged
Note that I am behind a firewall (no internet access during execution) using
Jenkins 2.73.2
This is a clean install of jenkins on windows, the only change I made was to enable Java web start.
Try the following syntax for the pipeline:
node("poolA"){
echo "Jenkins pipeline for rapidx node"
}