1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

Add more migrations to wait

This commit is contained in:
Kay0u 2022-04-05 16:40:14 +02:00
parent c9f3c1ae34
commit 56b6f50053
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -317,20 +317,48 @@ then
# https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading
if dpkg --compare-versions "$current_version" "ge" "12.9"; then
counter=0
while ! gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'
do
counter=$((counter + 1))
if [ $counter -gt 1200 ]
then
ynh_print_warn --message="Timeout: a background migration runs for at least 20min !"
break
fi
ynh_print_info --message="Wait for the migration in the background to finish"
sleep 1
done
checkBackgroundMigration=1
else
checkBackgroundMigration=0;
fi
if dpkg --compare-versions "$current_version" "ge" "14.0"; then
checkDBBackgroundMigration=1
else
checkDBBackgroundMigration=0;
fi
if dpkg --compare-versions "$current_version" "ge" "14.7"; then
checkBatchedBackgroundMigration=1
else
checkBatchedBackgroundMigration=0;
fi
counter=0
while [ $checkBackgroundMigration -eq 1 ] || [ $checkDBBackgroundMigration -eq 1 ] || [ $checkBatchedBackgroundMigration -eq 1 ]
do
counter=$((counter + 1))
if [ $counter -gt 1200 ]
then
ynh_print_warn --message="Timeout: a background migration runs for at least 20min !"
break
fi
if [ $checkBackgroundMigration -eq 1 ] && gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining' | grep -q -w 0
then
checkBackgroundMigration=0
fi
if [ $checkDBBackgroundMigration -eq 1 ] && gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigrationJob.pending' | wc -l | grep -q -w 0
then
checkDBBackgroundMigration=0
fi
if [ $checkBatchedBackgroundMigration -eq 1 ] && echo "select COUNT(*) from batched_background_migrations where status <> 3;" | gitlab-psql -t -A | grep -q -w 0
then
checkBatchedBackgroundMigration=0
fi
ynh_print_info --message="Wait for the migration in the background to finish"
sleep 1
done
done
fi