Retain build metadata after upgrade

Dear all

I’m in the process of setting up a new GitLab instance starting from a backup. The backup was made on version 9.5 and restoring it to a new 9.5 instance works fine.

I’m following this path of upgrades, with the intention of upgrading further:
9.5.10 => 10.8.7 => 11.4 => 11.5 => 11.6 => 11.7

When upgrading from 11.6 to 11.7 my build jobs get archived and I can no longer re-run them. However, when at 11.5/11.6 I can see a setting in the CI/CD settings page where I can set the build job expiration time. Even when I set this to 1 or 2 years, my build jobs (some as “recent” als 1 month) get archived.

How can I prevent this behaviour?
The related issue is Deprecate retention of build metadata older than 3 months (#50939) · Issues · GitLab.org / GitLab FOSS · GitLab

I’m using the CE distribution running in Docker.
I am upgrading my stopping and removing the existing container and starting a new one with the next version in the upgrade path.

Thank you in advance for any advice you might have on this matter.

This seems to be caused by a new serialization format for the build metadata.

The ci_builds_metadata table gets introduced, containing the build scripts of older jobs in a serialized form.
When upgrading from 11.6 to 11.7, this data does not get migrated which causes older jobs to be un-replayable.