Re: Disk space is too low. Only "less than a GB" left on /var/lib/jenkins

2018-08-06 Thread Amit Ghatwal
Few methods which we employ to save on space is by using 
1. any "post-build" for any job to delete job workspace if not needed. 
2. Limit the number of job build logs to minimum - say around 2-4.
3. Install this disk usage plugin - 
https://wiki.jenkins.io/display/JENKINS/Disk+Usage+Plugin which helps 
monitor.


On Wednesday, 1 August 2018 15:34:16 UTC+5:30, Víctor Puertas wrote:
>
> My master node became disconnected due to this error:
> - Disk space is too low. Only "less than a GB" left on /var/lib/jenkins
> The current size of the directory is 5.4GB.
> Why does this folder weight that much?
> Is there a way to decrease the size without adding space on the machine? 
> I'm thinking a solution as removing temporary files but I'm not familiar 
> with the content of this directory.
>
> Thanks.
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7df599ce-c4ed-405f-b5e0-709b9c00f1f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can i run master and slave on same machine

2018-08-06 Thread Amit Ghatwal
I have set up a single machine to run as jenkins- master+slave successfully 
many a times , been able to deploy jobs successfully as well  on the 
machine at "Remote root directory" for the added slave node .Every job 
deployed creates a folder with the job name .  Can you elaborate more on 
where exactly ur getting this message - 'file available" , any launch 
methods which is giving this message - JNLP, SSH , webstart, etc. ?


On Monday, 6 August 2018 10:12:55 UTC+5:30, Nehal Abdelhafez wrote:
>
>
> can you just tell me how i can run master and slave on the same machine i 
> have install and run a master and i cant make the slave join it gives error 
> "file avaliable " thanks in advance 
>
> On Wednesday, June 27, 2012 at 4:26:03 PM UTC+2, Mark Waite wrote:
>>
>> The simplest answer to your "Can I run master and slave on the same 
>> machine" is "Yes".  The challenging part of the question is "Why?"
>>
>> The subject line seems to hint that you are considering running a master 
>> and a slave on the same machine.  It certainly can be done.  Whether it 
>> should be done depends on your reason for wanting to use a slave.
>>
>> The Jenkins master can run multiple jobs in parallel so long as you allow 
>> have enough executors defined on the master node to host your parallel 
>> jobs.  If the master machine has enough compute power to perform all the 
>> parallel jobs, then executing all the jobs on the master node is simpler 
>> because it is easier to administer one machine (the master) than two 
>> machines (the master and the slave).
>>
>> If the master machine does not have enough compute power to perform all 
>> the parallel jobs, then additional computers can be added as slave nodes to 
>> add compute power.
>>
>> Another use of master and slave is when different configurations are 
>> needed.  For example, I have a master node that is 64 bit Linux and slave 
>> nodes for 32 bit Linux, 32 bit Windows, and 64 bit Windows.  I couldn't run 
>> that configuration without master and slave setups.
>>
>> I believe others have used a slave configuration to create a separate 
>> configuration even on the same machine.  That is not a technique I've used, 
>> but I've considered it, possibly using a slave running in a chroot 
>> environment on a Linux machine to simulate a different configuration 
>> without actually running on a different machine.
>>
>> It is also possible to run a master and a slave on the same machine 
>> simply by configuring the slave node to use a different home directory than 
>> the master node.  I'm not sure why you would do that, but it can be done.
>>
>> Mark Waite
>>
>>
>>
>> --
>> *From:* Varghese Renny 
>> *To:* jenkins...@googlegroups.com 
>> *Sent:* Tuesday, June 26, 2012 8:53 PM
>> *Subject:* Can i run master and slave on same machine
>>
>>
>> I have a doubt regarding, if multipe jobs are there ,is it better to 
>> distribute build on slave or
>> do it on master itself?
>> if i can do master and slave? how can i implement this?
>>
>>
>>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/20047d71-6c2a-4913-b518-c494ab32de0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating groovy script to configure slave node properties >> "Restrict jobs execution at node"

2016-10-05 Thread Amit Ghatwal
Hi Indra,

Got it working with the below changes to my groovy script . Copying the 
updated script for benefit of others

import jenkins.model.*
import hudson.model.*
import hudson.slaves.*
import hudson.plugins.sshslaves.*

import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.nodes.
JobRestrictionProperty;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.job.
StartedByUserRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.util.UserSelector;
import java.util.List;

List usersList;

UserSelector  u1 = new UserSelector ("user1");
List userlist = new LinkedList();
userlist.add(u1);

StartedByUserRestriction startuserrect = new StartedByUserRestriction(
userlist, false, false,false );

JobRestrictionProperty jobrestrict = new JobRestrictionProperty(
startuserrect);

List restrictlist = new LinkedList();
restrictlist.add(jobrestrict);


  Slave slave = new DumbSlave(
"agent-node",
"Agent node description",
"/home/jenkins",
"1",
Node.Mode.NORMAL,
"agent-node-label",
new SSHLauncher("172.17.1.55",22,"root","root","","","",
"",""),
new RetentionStrategy.Always(),
restrictlist)
  Jenkins.instance.addNode(slave)


Thanks for all the guidance and pointing out the detailed steps.

Thanks and regards,
Amit


On Wednesday, 5 October 2016 12:04:11 UTC+5:30, Amit Ghatwal wrote:
>
> Hi Indra ,
>
> You've have hit the nail on its head , you have perfectly summarized my 
> requirements and precisely what i intent to achieve via a groovy script.
>
> import jenkins.model.*
> import hudson.model.*
> import hudson.slaves.*
> import hudson.plugins.sshslaves.*
> import java.util.ArrayList;
> import hudson.slaves.EnvironmentVariablesNodeProperty.Entry;
>
>
> import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.nodes.
> JobRestrictionProperty; 
>
> import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.Messages;
> import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.
> JobRestriction;
> import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.
> JobRestrictionBlockageCause;
> import hudson.Extension;
> import hudson.model.Node;
> import hudson.model.Queue;
> import hudson.model.queue.CauseOfBlockage;
> import hudson.slaves.NodeProperty;
> import hudson.slaves.NodePropertyDescriptor;
> import org.kohsuke.stapler.DataBoundConstructor;
>
>   List env = new ArrayList();
>   env.add(new Entry("key1","value1"))
>   env.add(new Entry("key2","value2"))
>   EnvironmentVariablesNodeProperty envPro = new 
> EnvironmentVariablesNodeProperty(env);
>   Slave slave = new DumbSlave(
> "agent-node","Agent node description",
> "/home/jenkins",
> "1",
> Node.Mode.NORMAL,
> "agent-node-label",
> new SSHLauncher("agenNode",22,"user","password","","",
> "","",""),
> new RetentionStrategy.Always(),
> new LinkedList())
>   slave.getNodeProperties().add(envPro)
>   Jenkins.instance.addNode(slave)
>
> I am actually kind of new to "groovy" , if u don't mind , as referred by 
> you in above points : 1,2,3,4,5 is perfectly what i need , but if you could 
> help in editing above groovy code to incorporate the points 1-5 as 
> mentioned by you would be helpful.
>
> Appreciate your time and help.
> Thanks and regards,
> Amit
>
> On Wednesday, 5 October 2016 11:12:23 UTC+5:30, Indra Gunawan (ingunawa) 
> wrote:
>>
>> 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.
>> 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 AbstractUserCauseRestricti

Re: Creating groovy script to configure slave node properties >> "Restrict jobs execution at node"

2016-10-05 Thread Amit Ghatwal
va/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: <jenkins...@googlegroups.com > on behalf of Amit 
> Ghatwal <ghatw...@gmail.com >
> Reply-To: "jenkins...@googlegroups.com " <
> jenkins...@googlegroups.com >
> Date: Tuesday, October 4, 2016 at 9:25 PM
> To: Jenkins Users <jenkins...@googlegroups.com >
> 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 jenkinsci-use...@googlegroups.com .
> 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_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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/55cca636-4217-4145-b201-b30db8d83d34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating groovy script to configure slave node properties >> "Restrict jobs execution at node"

2016-10-04 Thread Amit Ghatwal
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3d03feac-510c-4ba2-987c-76e50b7a1f38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Creating groovy script to configure slave node properties >> "Restrict jobs execution at node"

2016-10-03 Thread Amit Ghatwal

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 jenkinsci-users+unsubscr...@googlegroups.com.
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.