How can I point Jenkins to another .jenkins home directory?

后端 未结 7 1548
攒了一身酷
攒了一身酷 2020-12-29 07:17

I have the working /.jenkins folder under a specific user in home on Linux. I want to start Jenkins with another user, but re-use the .jenkins folder of the other user. How

相关标签:
7条回答
  • 2020-12-29 07:43

    In Tomcat 5 you can modify tomcat.conf and add the path:

    export JAVA_OPTS="-DJENKINS_HOME=/home/jenkins"

    Restart Jenkins.

    0 讨论(0)
  • 2020-12-29 07:47

    Jenkins was not taking JENKINS_HOME env variable i set for some weird reason.

    The i added this line in tomcat start up script(/etc/init.d/tomcat).

        $export JENKINS_HOME=/path/to/jenkins_home/
    

    Now jenkins points to the new jenkins home :) This will be useful especially when you install jenkins on cloud. (on an Ec2 or eucalyptus intance)

    Reference: https://wiki.jenkins-ci.org/display/JENKINS/Tomcat

    0 讨论(0)
  • 2020-12-29 07:50

    I think this can help you out.

    Set an Environment Variable JENKINS_HOME pointing to the .jenkins folder and run the Jenkins command.


    The shell should be like

    export JENKINS_HOME=/usr/jhon/.jenkins
    
    java -jar jenkins.war
    


    The batch should be like

      SET JENKINS_HOME=C:\users\jhon\.jenkins
    
     java -jar jenkins.war
    


    The Powershell should be like

    [Environment]::SetEnvironmentVariable("JENKINS_HOME", "${PWD}\.jenkins")
    java -jar jenkins.war
    

    This will set your home directory to the current-working-directory + './jenkins'

    0 讨论(0)
  • 2020-12-29 07:53

    Usually, you need to set the permissions for those files to be accessed by the new user.

    See here: How to run jenkins as a different user -
    especially the answers of Sagar and Peter Tran .

    Cheers

    0 讨论(0)
  • 2020-12-29 07:55

    I am using jenkins 1.639 as a war deployed on tomcat 7.0.67 . My JENKINS_HOME is set to /home/hims/jenkins

    This is the entry of my setenv.sh file under /tomcat/bin directory

    export CATALINA_OPTS="-DJENKINS_HOME=/home/hims/jenkins"

    I hope this helps.

    0 讨论(0)
  • 2020-12-29 07:56

    Here are the options you have:

    a) Assuming you're deploying Jenkins into Tomcat,you can do the following:

    In your catalina.home/conf/localhost/jenkins.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <Context docBase="/home/enomad/projects/jenkins/jenkins-master/war/target/jenkins" path="" reloadable="true">
     <Environment name="JENKINS_HOME" value="/home/enomad/projects/jenkins-home"
             type="java.lang.String" override="false"/>
    </Context>
    

    b) You can export the JENKINS_HOME=toWhateveryouwant as mentioned by Harsha in the previous post

    c) You can extend your JAVA_OPTS params and add -DJENKINS_HOME=/path/to/jenkins_home/ as described here: Jenkins Mailing list

    Good luck!

    0 讨论(0)
提交回复
热议问题