Hi All,

I am trying to automate the process of creating a slave node on jenkins 
server , creating users and then and also allow certain users to access 
only certain slave nodes. The automation is to be achieved via a groovy 
script.

Here's my script thus far
import jenkins.model.* 
import hudson.security.* 
import hudson.slaves.*
import hudson.plugins.sshslaves.*
import hudson.model.*


SLAVE_IP_ADDR="172.17.1.55"
SLAVE_LOGIN="root"
SLAVE_PWD="root"

SLAVE_NODE_LABEL="My_Slave_Node_Autogenerated-Label"


println "create a slave node.. \n\r"
Slave slave_node = new DumbSlave( 
"My_Slave_Node_Autogenerated",
"This slave node is generated using a jenkins job via groovy script",
"/home/jenkins",
"1",
Node.Mode.NORMAL,
SLAVE_NODE_LABEL,
new SSHLauncher(SLAVE_IP_ADDR,22,SLAVE_LOGIN,SLAVE_PWD,"","","","",""),
new RetentionStrategy.Always(),
new LinkedList()
)
Jenkins.instance.addNode(slave_node)



So doing above , i am able to achieve creation of slave nodes, now what i 
want to do is to restrict the users created ( done by a groovy script too ) 
to have restricted access to the slave nodes created above. For this we 
need "job-restriction" plugin installed. I have version 0.5 installed on my 
server. Post installation of the plugin ,i have " Restrict jobs execution 
at node " option seen under " Node properties " for any slave node 
configure setting.

Now i can manually on the jenkins UI , i am able to achieve restriction of 
users created for any slave node , however do i get this automated using a 
groovy script.

Any thought how "Restrict jobs execution at node " can be achieved using a 
groovy script ? Any pointers will be helpful

Thanks and regards,
Amit

I

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/82077b14-66ad-4a86-8887-dd1113197c31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to