Hi Amit, The https://github.com/jenkinsci/job-restrictions-plugin/blob/master/src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/nodes/JobRestrictionProperty.java class clearly extends NodeProperty<Node>. 1. You need to instantiate a new JobRestrictionProperty class giving to it a new instance of jobRestriction class.
2. You are saying you want to Restrict jobs execution at node just for User? Do you want to configure "Started by User"? I assume you do, therefore you then browse to https://github.com/jenkinsci/job-restrictions-plugin/blob/master/src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/job/StartedByUserRestriction.java This class extends AbstractUserCauseRestriction which extends jobRestriction so this class is a subclass of JobRestriction. You need to instantiate a new StartedByUserRestriction class giving it : (list of UserSelector, false, false, false). <== I presume you just want the list of users able to run job on the node, with no Upstream Job started by user or AutoRun or started by Anonymous User. 3. You pass in "StartedByUserRestriction" class created when you instantiate the new "JobRestrictionProperty" class. 4. Then you create a new LinkList and you add the JobRestrictionProperty class instance to the List. 5. You pass in the LinkList as the last parameter to the creation of the new DumbSlave class to create new node/Agent (see nodeProperties below): http://javadoc.jenkins-ci.org/hudson/slaves/DumbSlave.html public DumbSlave(String<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true> name, String<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true> nodeDescription, String<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true> remoteFS, String<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true> numExecutors, Node.Mode<http://javadoc.jenkins-ci.org/hudson/model/Node.Mode.html> mode, String<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true> labelString, ComputerLauncher<http://javadoc.jenkins-ci.org/hudson/slaves/ComputerLauncher.html> launcher, RetentionStrategy<http://javadoc.jenkins-ci.org/hudson/slaves/RetentionStrategy.html> retentionStrategy, List<http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true><? extends NodeProperty<http://javadoc.jenkins-ci.org/hudson/slaves/NodeProperty.html><?>> nodeProperties) throws IOException<http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true>, Descriptor.FormException<http://javadoc.jenkins-ci.org/hudson/model/Descriptor.FormException.html> From: <[email protected]<mailto:[email protected]>> on behalf of Amit Ghatwal <[email protected]<mailto:[email protected]>> Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Date: Tuesday, October 4, 2016 at 9:25 PM To: Jenkins Users <[email protected]<mailto:[email protected]>> Subject: Re: Creating groovy script to configure slave node properties >> "Restrict jobs execution at node" Hi Victor, Thanks for quick comment. I had already looked at the below repo of "job-restriction plugin" - https://github.com/jenkinsci/job-restrictions-plugin/tree/master/src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions However i am unable to figure how do i change the slave node >> configure >> Node Properties >> Restrict jobs execution at node via a groovy script ? Any pointers on how can i bring out the above change might be helpful. Thanks and regards, Amit On Tuesday, 4 October 2016 22:24:47 UTC+5:30, Victor Martinez wrote: You might need to look at the job resctriciton plugin to find its jobs properties and create that property: https://github.com/jenkinsci/job-restrictions-plugin/blob/master/src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/nodes/JobRestrictionProperty.java The above url might help you to understand what that plugin does Cheers -- 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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3d03feac-510c-4ba2-987c-76e50b7a1f38%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/3d03feac-510c-4ba2-987c-76e50b7a1f38%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- 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/D419DC52.5E076%25ingunawa%40cisco.com. For more options, visit https://groups.google.com/d/optout.
