I have a Jenkins Server on version 2.361.2.
I have 2 users: test and test1
I have 2 jobs: job and job1
I have 2 nodes : node0 and node01
So, my user test can see job called job and my user test1 can only see job call job1
But users test and test1 can see all node:
The Result..
And, I see that my user test can only see node called node0 and my user test1 can only see node called node01
like that:
What I want
I have installed the following plugin:
Authorized plugin
Restrict job
job-restriction
I have configure job restriction, but nodes are KO
Related
I created a Jenkins node / agent / slave and use it for a pipeline. On the node's page there is a list "Projects tied to mynode". What does this mean? When is a project "tied" to a node?
Btw.: If "tied to a project" means here, that the node is used in a project, so why is this list empty?
"Projects tired to ...." will list Freestyle jenkins job which restrict the job executed on this node by specify the node label in job's configuration field:
Restrict where this project can be run -> Label Expression
After you run the job, your job will appear in the "Projects tired to ...." list
I think this list purpose is to let user know the impacted jobs when the node down or before restart or repair the node.
FYI, if the node label filled in Label Expression serviced by more than one machine, the job won't appear in that list. Because job can be executed on any one machine in that group.
I have two Jenkins that are located on a different instances, I want to trigger Job 'A' on Jenkins 'A', after a job 'B' finished running and succeeded on Jenkins 'B'.
One simple way would be to add a webhook for a Job 'A' on Jenkins 'A' that starts the job, and let job 'B' on Jenkins 'B' trigger this webhook.
This plugin might be helpful with this
You can use Jenkins API to trigger the job on another instance, please see the below API
curl -X POST --user user:password http://JenkinsA:8080/jenkins/job/A/build
You can have a condition if Jenkins "B" job is successfully run the above API.
I have a job which has the node name as a parameter(Made possible using NodeLabel Parameter Plugin).
I will trigger the job always with node1 as the parameter. I want the job to see node 1 is online and free(no other builds are going on in that node). If node1 is free run this job on node1 else this job should find a free node and run it on that(ie; trigger this same job in other node (eg; node2) if node1 is not free).
How can I do that? How can I know whether a node is free? I don't want my job to be waiting for a node to complete other builds.
Have the same label name on both agents (for example "windows") and have your job run with label "windows". It will run in a little different manner. In this case when you run that job with target label "windows", jenkins will send the request to both nodes but jenkins will run the job on the agent which will respond first.
I have a some Jobs running on jenkins that has several nodes.
In the past I forced all my jobs to run all on the same node.
Now for purpose of load distribution I would like to reduce this constraints.
But sometimes I need one Job that is triggered by another to run on the same node.
This triggered Job can be triggered by any job (with different parameters) but if this is triggered by a Job it should run on the same node.
e.g.:
Triggered Job = Job_T
Any Jobs: Job1, Job2, Job3
Node X: Run Job1 -> Job_T(Job1)
Node Y: Run Job2 -> Job_T(Job2)
Node X: Run Job3 -> Job_T(Job3)
Is this possible to configure in the Jenkins Jobs?
Parameterize your jobs if they are not already. Pass the parent job node label as parameter to the downstream (triggered) job
Let's says I have configured a Jenkins job which can run on a few Jenkins slave nodes (e.g. Node1, Node2, Node3, etc). When a build is started, Jenkins will select an available Jenkins slave to run the Build.
For a Build which has completed, or is currently running, how to programmatically determine which Jenkins slave node has been used to run the Build?
You can use the Jenkins REST API to query an existing build assuming you know the build number:
http://jenkins:8080/job/JOB_NAME/100/api/json?pretty=true
The builtOn field shows the name of the slave which is running/ran the build.
To retrieve only a couple fields of the JSON build information, use the tree parameter:
http://jenkins:8080/job/JOB_NAME/100/api/json?tree=id,timestamp,builtOn&pretty=true
This will return something like:
{
"id" : "2014-12-01_06-18-17",
"timestamp" : 1417443497917,
"builtOn" : "sdev05"
}
Most pages in the Jenkins UI have a REST API link at the bottom indicating they expose information that can be queried programmatically.