Everytime I need to upgrade to the next big Gitlab CE release, I end up jumping through hoops, looking for specific steps or going through .bash_history
to see what I've done in the past. This is a small self-note on what to do next time.
So running
sudo apt update -y; sudo apt upgrade -y; sudo apt autoremove -y;
lead me to a cryptic message
Preparing to unpack .../gitlab-ce_15.0.0-ce.0_amd64.deb ...
gitlab preinstall: It seems you are upgrading from major version 14 to major version 15.
gitlab preinstall: It is required to upgrade to the latest 14.10.x version first before proceeding.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrade-paths
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_15.0.0-ce.0_amd64.deb (--unpack):
However I'm running 14.9.3
which is pretty recent, considering that I update my machines every few weeks. The confusing part here is that there is no simple instructions in the error message or on the support website as to what to do next. The more confounding thing is, that support website doesn't even mention version 14.10 as an option.
Support link outlines the upgrade path and which versions to use for an upgrade path, but not how to do it.
Warning ⚠️
The following command was executed on a system that was FULLY backed up using both GitLab backup process and a VM snapshot.
Do this at your own risk 😳
Well turns out it's actually very simple on ubuntu/debian using apt for my GitLab:
# First I removed old backups that were taking up a lot of space
# from /var/opt/gitlab/backups/
sudo apt upgrade -y gitlab-ce=14.10.0-ce.0
This process may take a bit of time depending on how fast your VM is & how big your Gitlab install is. Took about 15 mins for me.
If you need to upgrade from an earlier version of GitLab - the same steps apply. You just need to follow the upgrade path outlined on the support website. And NO you CANNOT skip steps, the result will be unpredictable.
Now we are all ready to install the latest GitLab CE, which can be done using a general command like so, if you like to risk it all
sudo apt update -y; sudo apt upgrade -y; sudo apt autoremove -y;
or simply
sudo apt upgrade -y gitlab-ce
P.S.: Don't forget to reboot.
P.P.S.: Reminder to Future Me - don't freak out if you see a 500 error response. GitLab takes 3-5 mins to fully come up after a full reboot.
Top comments (4)
When you wish to upgrade a few versions, it's worth mentioning their convenient Upgrade Path tool.
Thanks for this beautiful post:)
What do you do if the package you are trying to install is not in your package repository?
This command:
sudo apt upgrade -y gitlab-ce=14.10.0-ce.0
....results in a not found error.
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash