jenkins_home, docker, upgrades

25 views
Skip to first unread message

Ewelina Wilkosz

unread,
Dec 7, 2020, 10:12:10 AM12/7/20
to Jenkins Users

Hi!

I am using Jenkins in Docker and I map a folder from local machine to the container's /var/jenkins_home to preserve JENKINS_HOME.

There are two things I am wondering about, and maybe you can comment:

1. Can new Jenkins corrupt existing JENKINS_HOME?
Let's assume I have Jenkins in version X running, I want to upgrade so I have built new image, with Jenkins version Y, same plugins - maybe updated during the image build

Is it possible that when I restart Jenkins with new image with version Y, the existing JENKINS_HOME won't be compatible with new version?
Is it possible that after restart JENKINS_HOME will be changed in a way that it won't be possible to use it again with version X - if I want to rollback for whatever reason?

2. What happens when two instances share JENKINS_HOME?
I want to have a simple test environment - let's not discuss now if it's a good or bad approach :) - so next to a working Jenkins container I start another one in a quiet mode (no job will start), with a new image I want to try out
The first idea is to copy original JENKINS_HOME and use this copy, but what if the home is very big and I do not have much space - how bad would running second Jenkins with JENKINS_HOME mapped to the same folder on a local host would be? (I haven't considered that option, but I was asked 'why')

I know I can just run it and check, but I think there might be plenty of different cases that I will not see in my simple test, but maybe some of you have more experience or ran into issues before

BR
Ewelina

Ahmed Rafiq

unread,
Dec 12, 2020, 5:44:26 AM12/12/20
to jenkins...@googlegroups.com
hello,
for your question 1, i can share my experience. We are using near same settings as you describe, jenkins in docker and Jenkins_home point to a docker volume. 
There's no problem once you upgrade the Jenkins version and point the new version jenkins_home to old docker volume. What I do is, before upgrade to be version rename the Jenkins_home, and after upgrade renamed to original.

--
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/97993ad1-85da-489b-9d8c-ebb436fb6b79n%40googlegroups.com.

Ivan Fernandez Calvo

unread,
Dec 12, 2020, 1:47:50 PM12/12/20
to Jenkins Users
El lunes, 7 de diciembre de 2020 a las 16:12:10 UTC+1, ewel...@gmail.com escribió:

Hi!

I am using Jenkins in Docker and I map a folder from local machine to the container's /var/jenkins_home to preserve JENKINS_HOME.

There are two things I am wondering about, and maybe you can comment:

1. Can new Jenkins corrupt existing JENKINS_HOME?
Let's assume I have Jenkins in version X running, I want to upgrade so I have built new image, with Jenkins version Y, same plugins - maybe updated during the image build

Is it possible that when I restart Jenkins with new image with version Y, the existing JENKINS_HOME won't be compatible with new version?
Is it possible that after restart JENKINS_HOME will be changed in a way that it won't be possible to use it again with version X - if I want to rollback for whatever reason?


It depends of your plugins installed, so it is possible you screw up your Jenkins Home if you do not test your upgrade in a test instance, it is not common but it could happens, thus is recommended to clone your Jenkins home folder and test the upgrade before to make it on production. Also, take a backup before to make the upgrade is mandatory. Rollback is not supported, even though it could work, it is better to restore the backup form the previous version.
 
2. What happens when two instances share JENKINS_HOME?
I want to have a simple test environment - let's not discuss now if it's a good or bad approach :) - so next to a working Jenkins container I start another one in a quiet mode (no job will start), with a new image I want to try out
The first idea is to copy original JENKINS_HOME and use this copy, but what if the home is very big and I do not have much space - how bad would running second Jenkins with JENKINS_HOME mapped to the same folder on a local host would be? (I haven't considered that option, but I was asked 'why')

I know I can just run it and check, but I think there might be plenty of different cases that I will not see in my simple test, but maybe some of you have more experience or ran into issues before


Really bad idea, Jenkins keep changes in memory and write them to disk, so if you have two instances running in the same Jenkins home and you change a job in one of them the other does not know anything about his change, the configuration is not read from disk on runtime, most of the configuration is only read at start time and keep updated in memory. So two instances running on the same Jenkins home is a random behaviour environment.

 
BR
Ewelina

Ewelina Wilkosz

unread,
Dec 15, 2020, 7:44:39 AM12/15/20
to Jenkins Users
thank you for sharing your experiences, that was helpful
Reply all
Reply to author
Forward
0 new messages