Use Master/Slave architecture on the same linux machine.

71 views
Skip to first unread message

iostrym

unread,
Oct 9, 2015, 11:02:51 AM10/9/15
to Jenkins Users
We have a multi-user linux server.

Jenkins in installed and configured as master.

Some jobs need to be run by a user TOTO for some specific reasons (license access for example)

One of our solution is to use "execute shell script on remote host using ssh" but then the workspace is still on the jenkins user whereas data are generated on the TOTO home directory. We would like to avoid a script to move data generated (pretty dirty)

So I wonder if it is possible to install a slave jenkins for each user on the same linux machine ? Then the job workspace will be on TOTO homespace.

What is the most-used multi-user linux architecture for Jenkins ? 

Best regards,

Mark Waite

unread,
Oct 9, 2015, 4:58:05 PM10/9/15
to Jenkins Users
The Jenkins slave launch will allow you to launch the slave as the user TOTO.  Then all jobs which run on that slave will be executed as the user TOTO.  You can even run multiple slaves as the same user (though I don't know why you would), so long as you use a distinct directory for each of the slaves.

Mark Waite

--
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/68956858-28c3-4b0d-bc1c-f789c3f644fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

iostrym

unread,
Oct 9, 2015, 5:15:44 PM10/9/15
to Jenkins Users
Thanks a lot for your answer.

Then can you confirm me that it is possible to have a master (user jenkins) and its slave (user TOTO) on the same linux machine ?

If yes, is it a abnormal and tricky way of doing (hard to do, badly documented, with low chance of success) or is it a common way of doing ?

Mark Waite

unread,
Oct 9, 2015, 5:52:00 PM10/9/15
to jenkins...@googlegroups.com
I can confirm that it is possible to have a master and a slave on the same Linux machine where the master runs as one user and the slave runs as another user.

It is atypical because most Jenkins users don't need a specific user to execute their build steps.  It is not abnormal or hard to do.

I've never seen any documentation which describes how to do that, though there are help icons beside each of the fields which control that behavior.

Using our Jenkins server (running as the user "jenkins"), I configured a slave to run as the user "mwaite" on the same machine by configuring a slave, and selecting credentials for the user mwaite from the "Advanced" section of the Jenkins nodes configuration page.  Then I ran a job on that slave which executed the command "id".  That command showed that the slave is running as the user "mwaite" as expected.

Mark Waite

armandooooo

unread,
Oct 9, 2015, 5:58:27 PM10/9/15
to jenkins...@googlegroups.com
thanks a lot for details.

I was told that one jenkins installation must be configured as master OR slave.

When I read your post, it seems that it is possible to configure a slave on the same machine without installing another Jenkins installation and configure it as a slave:

one jenkins installation could be configured as a master and also be used to configure other slaves ? right ?

--
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/zvHK5yl-dcs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtEtB6WgO8LKcMnYHPe1gKH%2BoREFkw%2B%3DR1jScdCXxUGysg%40mail.gmail.com.

Mark Waite

unread,
Oct 9, 2015, 6:02:43 PM10/9/15
to jenkins...@googlegroups.com
On Fri, Oct 9, 2015 at 3:58 PM armandooooo <arman...@gmail.com> wrote:
thanks a lot for details.

I was told that one jenkins installation must be configured as master OR slave.

When I read your post, it seems that it is possible to configure a slave on the same machine without installing another Jenkins installation and configure it as a slave:

one jenkins installation could be configured as a master and also be used to configure other slaves ? right ?

That's right.

The general guidance is one slave per machine because a single slave can have multiple executors.  Executors are lighter weight than slaves, since they exist within a slave.  Your use case is atypical because you need different system level attributes (logged in user, signing certificate access, etc.) for different jobs.

Mark Waite
 

iostrym

unread,
Oct 12, 2015, 8:38:32 AM10/12/15
to Jenkins Users
Thanks a lot. tested with success. master and slave on same unix machine without doing anything else that playing with "add a node" in Jenkins administration.

Concerning ressource taken by jenkins slave. do you have an idea ? Because if we need one slave per user on the unix machine, there could be a ressource problem.

Mark Waite

unread,
Oct 12, 2015, 10:58:04 AM10/12/15
to jenkins...@googlegroups.com
Slave resource usage depends very much on the build jobs you run on the slave.  Your use case (a separate slave logged in as this specific user) seems unlikely to cause you to create less than 5 additional slaves on that machine.  General jobs will associate with the default slave.  Jobs which require the specific permissions of that user will associate with the slave designated (and labeled) for that user.

Mark Waite

Reply all
Reply to author
Forward
0 new messages