Re: Running test cases as different user in Jenkins

2014-07-09 Thread varun srivastava
Using unix groups looks like the correct approach here. I gave a try. It 
woks fine. Thanks.

Now, since I maintain a centralized jenkins instance that are used by 
different groups and want to run the test cases as application user(u2, u3, 
...) rather than jenkins runtime user (u1). Is there a way I can invoke the 
maven and ant targets as a different user (u2) than my jenkins run 
user(u1). In case of shell scripts I can do someting like sudo -u u2 
run_script.sh. But I am not able to figure out how to do this for maven and 
ant steps.

On Thursday, 3 July 2014 19:12:11 UTC+5:30, Fritz Elfert wrote:

 -BEGIN PGP SIGNED MESSAGE- 
 Hash: SHA1 

 On 07/03/2014 02:23 PM, varun srivastava wrote: 


 Not really a jenkins question. More like a generic Unix question: 
 How to share certain directories or files between different users, 
 where each user shall be able to write/delete 

 Solution: 
 That's what groups are intended for. 
 Create a dedicated group for this and make all participating users a 
 member of this group. Then, give directories rwx permissions for that 
 group and files at least rw permissions for that group. 

 CU 
  -Fritz 
 -BEGIN PGP SIGNATURE- 
 Version: GnuPG v1 
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ 

 iEYEARECAAYFAlO1XWoACgkQboM4mAMyprAOpACfUwVSbHkYE2fpnVIHI1wuG1Ba 
 OBEAoJPZ7gUEsREYIJFaaBBgB4F9Ky7u 
 =OlDa 
 -END PGP SIGNATURE- 


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Preserving last n working days builds

2014-07-09 Thread varun srivastava
Hi,

I want to preserve last 3 days build for my projects. But I do not run the 
builds on weekends, so I essentially want to preserve builds for last 3 
working days. Is there a way to achieve this in  jenkins.

Thanks
Varun

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Running test cases as different user in Jenkins

2014-07-03 Thread varun srivastava
Hi,

I have a centralized jenkins setup run as user u1. Different projects are 
set up on this instance. For running some testcases in some project, 
application user u2 permission is required. So I have granted permission to 
u1 to sudo as u2 only for running the test script/command. For example u1 
can sudo -u u2 run_test.sh
Now the problem is that the workspace is checked out as u1 but the test 
output files are generated with owner as u2. So I am not able to clean up 
the workspace as it contains files owned by both u1 and u2 and my cleanup 
plugin is run as u1.

Does any one has any solution for setting this up or do we have a plugin 
that can clean up the workspace as different user.

Summarizing the requirement :

1. Run jenkins as u1
2. Checkout and build project as u1.
3. Run test cases as u2. Note that u1 will have permission to sudo as u2 
only for running restricted set of commands.
4. Able to clean up the workspace post build properly (that may contain 
files owned by both u1 and u2)

Thanks,
Varun

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: Running test cases as different user in Jenkins

2014-07-03 Thread varun srivastava
Thanks Mark,

But running the slave node as u2 would mean that u1 can run any command as
u2 (equivalent to giving complete sudo permission for u2). I have
restriction that u1 can sudo as u2 only for running test command/script.


On Thu, Jul 3, 2014 at 6:23 PM, Mark Waite mark.earl.wa...@gmail.com
wrote:

 Could you change the requirements a little to simplify?

 For example, what if you had a slave that was running as user u2 and
 performed all its work as user u2.  It could copy the build results from
 the job which had been performed as user u1, then execute the tests as
 user u2.

 Mark Waite


 On Thu, Jul 3, 2014 at 6:23 AM, varun srivastava varun.itbh...@gmail.com
 wrote:

 Hi,

 I have a centralized jenkins setup run as user u1. Different projects are
 set up on this instance. For running some testcases in some project,
 application user u2 permission is required. So I have granted permission to
 u1 to sudo as u2 only for running the test script/command. For example u1
 can sudo -u u2 run_test.sh
 Now the problem is that the workspace is checked out as u1 but the test
 output files are generated with owner as u2. So I am not able to clean up
 the workspace as it contains files owned by both u1 and u2 and my cleanup
 plugin is run as u1.

 Does any one has any solution for setting this up or do we have a plugin
 that can clean up the workspace as different user.

 Summarizing the requirement :

 1. Run jenkins as u1
 2. Checkout and build project as u1.
 3. Run test cases as u2. Note that u1 will have permission to sudo as u2
 only for running restricted set of commands.
 4. Able to clean up the workspace post build properly (that may contain
 files owned by both u1 and u2)

 Thanks,
 Varun

  --
 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.

 For more options, visit https://groups.google.com/d/optout.




 --
 Thanks!
 Mark Waite

 --
 You received this message because you are subscribed to a topic in the
 Google Groups Jenkins Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/jenkinsci-users/mW2Dq0wbzWU/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 jenkinsci-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Thanks,

Varun Kr Srivastava
mobile- +91976033

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: Running test cases as different user in Jenkins

2014-07-03 Thread varun srivastava
My Jenkins instance is running as u1. Launching a slave as u2 might require
some permission to u1. I can get only restricted set of permission for u1
to do anything as u2.

I launch my slave using following unix command
ssh hostname java -jar /data/jenkins/slave.jar

If u1 is granted permission to launch slave as u2 using above command,
there is no restriction on what all commands can be launched on the slave
which is not desirable.


On Thu, Jul 3, 2014 at 6:34 PM, Mark Waite mark.earl.wa...@gmail.com
wrote:

 Maybe I stated poorly what I was suggesting.

 Don't allow u1 to sudo to u2 and don't allow u2 to sudo to u1.  Create two
 separate jobs, one that runs as user u1 on the slave that is running as u1,
 and the other that runs as user u2 on the slave running as u2.  Use copy
 artifacts or a similar technique to copy from the u1 job to the u2 job so
 that the files in the u2 job will always be owned by user u2.

 Mark Waite


 On Thu, Jul 3, 2014 at 6:57 AM, varun srivastava varun.itbh...@gmail.com
 wrote:

 Thanks Mark,

 But running the slave node as u2 would mean that u1 can run any command
 as u2 (equivalent to giving complete sudo permission for u2). I have
 restriction that u1 can sudo as u2 only for running test command/script.


 On Thu, Jul 3, 2014 at 6:23 PM, Mark Waite mark.earl.wa...@gmail.com
 wrote:

 Could you change the requirements a little to simplify?

 For example, what if you had a slave that was running as user u2 and
 performed all its work as user u2.  It could copy the build results from
 the job which had been performed as user u1, then execute the tests as
 user u2.

 Mark Waite


 On Thu, Jul 3, 2014 at 6:23 AM, varun srivastava 
 varun.itbh...@gmail.com wrote:

 Hi,

 I have a centralized jenkins setup run as user u1. Different projects
 are set up on this instance. For running some testcases in some project,
 application user u2 permission is required. So I have granted permission to
 u1 to sudo as u2 only for running the test script/command. For example u1
 can sudo -u u2 run_test.sh
 Now the problem is that the workspace is checked out as u1 but the test
 output files are generated with owner as u2. So I am not able to clean up
 the workspace as it contains files owned by both u1 and u2 and my cleanup
 plugin is run as u1.

 Does any one has any solution for setting this up or do we have a
 plugin that can clean up the workspace as different user.

 Summarizing the requirement :

 1. Run jenkins as u1
 2. Checkout and build project as u1.
 3. Run test cases as u2. Note that u1 will have permission to sudo as
 u2 only for running restricted set of commands.
 4. Able to clean up the workspace post build properly (that may contain
 files owned by both u1 and u2)

 Thanks,
 Varun

  --
 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.

 For more options, visit https://groups.google.com/d/optout.




 --
 Thanks!
 Mark Waite

 --
 You received this message because you are subscribed to a topic in the
 Google Groups Jenkins Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/jenkinsci-users/mW2Dq0wbzWU/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 jenkinsci-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 --
 Thanks,

 Varun Kr Srivastava
 mobile- +91976033

 --
 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.
 For more options, visit https://groups.google.com/d/optout.




 --
 Thanks!
 Mark Waite

 --
 You received this message because you are subscribed to a topic in the
 Google Groups Jenkins Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/jenkinsci-users/mW2Dq0wbzWU/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 jenkinsci-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Thanks,

Varun Kr Srivastava
mobile- +91976033

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: Conditional build steps for maven projects

2014-02-17 Thread varun srivastava
Thanks for the reply.

I have tried this. But the disadvantage is that I loose features related to
maven projects like Displaying modules built, modules history etc. (For
multi-module maven projects)


On Tue, Feb 18, 2014 at 1:07 AM, Eric Pyle eric.p...@cd-adapco.com wrote:

  You can run a Maven build in a freestyle job. Add a build step of type
 Invoke top-level Maven targets. Then you can use conditional build steps
 and all other features of freestyle builds.

 Regards,
 Eric


 On 2/17/2014 2:13 AM, varun srivastava wrote:

 Hi,

 How can I run conditional steps with Maven projects ? For free style
 projects I am able to set up conditional steps but this seems not available
 with Maven projects.

 Additionally I also want to publish findbugs/pmd reports conditionally in
 maven projects. Again this looks possible using flexible publish plugin
 only for free style projects.

 Any help would be highly appreciated.

 -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.

 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to a topic in the
 Google Groups Jenkins Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/jenkinsci-users/7evg1xPffd8/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 jenkinsci-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Thanks,

Varun Kr Srivastava
mobile- +91976033

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Conditional build steps for maven projects

2014-02-16 Thread varun srivastava
Hi, 

How can I run conditional steps with Maven projects ? For free style 
projects I am able to set up conditional steps but this seems not available 
with Maven projects. 

Additionally I also want to publish findbugs/pmd reports conditionally in 
maven projects. Again this looks possible using flexible publish plugin 
only for free style projects. 

Any help would be highly appreciated. 

-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.
For more options, visit https://groups.google.com/groups/opt_out.