Upgrading to GitLab 15.0 CE from GitLab 14.9.3

A self-note on navigating GitLab's mandatory upgrade paths

determined-dog-devops-upgrade.png

TLDR: GitLab won’t let you upgrade directly from 14.9.3 to 15.0. You must upgrade to 14.10.x first, then to 15.0.


Every time 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.

Determined DevOps engineer dog carefully managing GitLab upgrade process with multiple monitors


The Problem

So running my usual update commands:

sudo apt update -y; sudo apt upgrade -y; sudo apt autoremove -y;

Led 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 are 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.

The support link outlines the upgrade path and which versions to use, but not how to do it.


The Solution

⚠️ 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:

Step 1: Upgrade to 14.10.x

# 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.

🔑 Key Thing

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.

Pro tip: GitLab has a convenient Upgrade Path tool that shows you exactly which versions to upgrade through.

Step 2: Upgrade to 15.0

Now we’re 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

Don’t Panic

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.


Resources


Originally published: dev.to/konung/upgrading-to-gitlab-150-ce-from-gitlab-1493-if5


Last updated: May 24, 2022

gitlab devops ubuntu debian linux infrastructure self-hosting