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:
parent
c9f3c1ae34
commit
56b6f50053
1 changed files with 41 additions and 13 deletions
|
@ -317,20 +317,48 @@ then
|
||||||
|
|
||||||
# https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading
|
# https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading
|
||||||
if dpkg --compare-versions "$current_version" "ge" "12.9"; then
|
if dpkg --compare-versions "$current_version" "ge" "12.9"; then
|
||||||
|
checkBackgroundMigration=1
|
||||||
counter=0
|
else
|
||||||
while ! gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'
|
checkBackgroundMigration=0;
|
||||||
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
|
|
||||||
fi
|
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
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue