Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy as Jenkins User or Allow Jenkins To Run As Different User?

I'm just getting started with Jenkins CI, and had a question which I'm struggling to find answers for in the docs or online. Wonder if someone might be able to offer some advice?

I'm attempting to use it to automatically deploy my dev and stage branches of my Django projects which are hosted on a Github organisation repository (ie, private). At the moment I have a user "django" who can access the Github repo via a Github deploy key. My Jenkins user can't access the repo. What's the best practice way of dealing with this - should I be creating an ssh deploy key for the "jenkins" user, or should I be getting Jenkins to run as my "django" user? I've seen mention if a HUDSON_USER in a newsgroup post, but I can't find reference to this in the docs.

Many thanks!

Ludo.

like image 679
Ludo Avatar asked Feb 09 '11 17:02

Ludo


People also ask

How do I run a Jenkins job as a different user?

To run a job by a specific user, you have to enable security options in jenkins. May be you have not used the enable security options in Jenkins and that is why it says started by anonymous user. You can create any number of users in Jenkins by providing their credentials.

How Jenkins run as Jenkins user?

Any agent can be configured to be launched as any user, so do that. Advise your company Jenkins Admin to change Jenkins immediately to NOT run as root. It does not need root (can be a daemon/service tho) and increases your risk exposure . We use Java Service Wrapper (RUN_AS_USER=jenkins) in Unix.

How do I run Jenkins on a different user in Windows?

Hi, Make sure you have the Jenkins workspace and root folder outside the user account where every user can access the Jenkins folder. Inside the Manage Jenkins you can set those path. You copy back you stuff from account A into the new folder and restart Jenkins and it should be able to see them into the new path.


1 Answers

I have not worked with Github and so this answer may not apply at all, but we do use Jenkins and we use both CVS & Subversion for source control.

In our system, we use different username/password combinations for all three (Jenkins, CVS, Subversion), and it has had no adverse effects yet (it has been a year since we deployed Hudson - currently building 50+ projects).

As long as you can get Jenkins to access the repo using your github deploy key, you shouldn't have to change Jenkins to run as django, or create a jenkins user key for github. Personally, I would keep them separate.

like image 140
Sagar Avatar answered Oct 12 '22 00:10

Sagar