Where is “Jenkins URL” configuration stored? - jenkins

I'm trying to set up a non-default URL as part of a puppet script that installs Jenkins. I know how to edit the value via the web UI but I can't seem to find where the value is actually stored. I've looked through the jenkins_home folder and apache and have yet to find it.

It stores it in a rather unlikely place: hudson.tasks.Mailer.xml in Jenkins home folder.

I'm on Jenkins 2.68 and it's stored at jenkins.model.JenkinsLocationConfiguration.xml under the Jenkins home folder.

If you don't find the URL when grepping Jenkins home, it's because you didn't saved the configuration. If not set, Jenkins fallback to request URL, without saving it on disk.
root#jenkins-dev:/var/lib/jenkins# grep jenkinsUrl *.xml
jenkins.model.JenkinsLocationConfiguration.xml: <jenkinsUrl>http://jenkins-dev.lxc/</jenkinsUrl>
root#jenkins-dev:/var/lib/jenkins#

The url can be found in the UI/web app under configuration > Jenkins Location; alternatively, login to your server and cat the contents at this location:
var/lib/jenkins/jenkins.model.JenkinsLocationConfiguration.xml

The file config.xml in the Jenkins home folder.

I did a grep for "http" in my Jenkins root directory led me to hudson.model.UpdateCenter.xml
I'm using Jenkins version 1.462

Related

Jenkins asking to enter initialadminstration password when upgrading version

I am trying to upgrade Jenkins version and deployed jenkins.war to webapps folder.After restarting the tomcat server jenkins taking to initial set up to register admin user.But i have already users created and assigned with roles.How to skip the initial set up and to to login page instead.
Looks like loading variables from JNDI was removed in 2.332.
https://community.jenkins.io/t/jenkins-home-variable-not-read-in-2-332-1-running-in-apache-tomcat-9/1826/4
To get it working, add the below in tomcat/bin/setenv.sh. Replace the path according to your directory structure
export JENKINS_HOME=/apps/jenkins

perfino agent is not logging to a file even when i use the logfile directive

I do something like this
-javaagent:/usr/local/lib/perfino/perfino.jar=server=ybperfino,name=${HSTNAMESHORT}-${APPNAME},group=${YBENV}/${HSTNAMESHORT},logMBean=10,logFile=${LOG_DIR}/perfinologs/${HSTNAMESHORT}-${APPNAME}.log
basically I want the log files to be created in the log directory for the app not the home directory for the userid
but it seems like the log file isn't being created either with logfile argument or with out !
using java11 if that makes any difference.
Found the answer - I had a competing java agent that was loading before it.
After I changed the order both java agents worked.

Change /tmp folder for jenkins in debian

I recently had a low disc space issue in jenkins. Although the home directory has sufficient space, the /tmp did not and it brought my master down.
I tried many ways to fix this
Discard old build and deleting old workspaces
Restarting jenkins
Tried to setup a node with same config and starting it, but that failed saying i dont have sufficient permission for copying remote.jar
Since my server is debian, I could not find any file where I could set set -Djava.io.tmpdir
Many people talked about jenkin file or config file, but I could not find it.
The only thing that worked was https://updates.jenkins-ci.org/download/plugins/tmpcleaner/ , this plugin hpi, which I installed through Advanced tag in plugins.
Also, I went manually to the /tmp folder in root and then deleted it contents to start the jenkins again. So my question is:
How do i change the /tmp folder in jenkins?
The jenkins home directory is /mnt/data/jenkins, however the tmp it uses it root/tmp. Why is it so? The /mnt/data/jenkins has lots of free space and i manually created a /tmp folder there, but it only takes the /tmp from the root
My colleague found the answer out
open '/etc/defaults/jenkins' file using command 'less /etc/defaults/jenkins'
Add argument
JAVA_ARGS="$JAVA_ARGS -Djava.io.tmpdir=yourNewtempLocation"
Once you restart jenkins, you will be able to see the storage of the new space

Changing JENKINS_HOME to another hard disk

I tried many tutorials I found on the internet on how to change the location of my JENKINS_HOME.
I still encountered these errors:
On the jenkins app - Unable to create the home directory ‘/mnt/2fe95e40-f8ba-418e-804c-0a25571f7b0c/jenkins’. This is most likely a permission problem.
On the jenkins logs - SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins
hudson.util.NoHomeDir
In the the tutorials they are saying that one of the reasons to change the JENKINS_HOME is the issue of the disk space, but their steps were always to change the directory to a new /home/<new_folder>. They are still using the same drive, they just change the folder it does not fix their disk space problem.
Does anyone know how to use the another hard disk as the new JENKINS_HOME? Without having to use
SymLink or Symbolic Link that point to another drive.
I am using Ubuntu 18.04.1 x64
Thanks.
I would do a fresh install on the new hard disk, then make a backup from the old location and restore it on the new disk.
If you do not agree with this approach you should check which user has permission on the Jenkins files and folders on the new hard disk.
stat [yourfilename or yourfolder]
Compare with JENKINS_USER variable in etc/default/jenkins.
Change the user if needed on the new location:
chown -R your_user /var/lib/jenkins
You will need to restart Jenkins and maybe reboot the machine.
As a second option, maybe Jenkins can not create its home directory in the new place. You can create the directory manually and then change JENKINS_HOME to point to it.
More info:
https://wiki.jenkins.io/display/JENKINS/Administering+Jenkins
https://askubuntu.com/questions/175054/how-to-find-owner-and-group-of-a-directory
Run jenkins job as another user
Can't get Jenkins to start using Tomcat

Jenkins: Changing default log files location in windows

I need to change the location of log files of jenkins outside of jenkins home(installation) directory. I checked in jenkins.xml file but did not found any parameter to set.
Gone through some articles but they suggest to create symlinks.
Please let suggest if anyone already did it.
You can change the log location by changing the default location for the logs in %JENKINS_HOME%/jenkins.xml. By default the logs get stored at %JENKINS_HOME%/jenkins.out and %JENKINS_HOME%/jenkins.err.

Resources