mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
Merge pull request #256 from YunoHost-Apps/master
fix check migration during upgrade
This commit is contained in:
commit
7ac88fcd7e
1 changed files with 7 additions and 25 deletions
|
@ -178,27 +178,17 @@ then
|
|||
# While the current version is not the last version, do an upgrade
|
||||
while [ "$last_version" != "$current_version" ]
|
||||
do
|
||||
# https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading
|
||||
if dpkg --compare-versions "$current_version" "ge" "12.9"; then
|
||||
checkBackgroundMigration=1
|
||||
else
|
||||
checkBackgroundMigration=0;
|
||||
fi
|
||||
# https://docs.gitlab.com/ee/update/background_migrations.html
|
||||
if dpkg --compare-versions "$current_version" "ge" "15.1"; then
|
||||
checkDBBackgroundMigration=2
|
||||
elif 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
|
||||
checkBackgroundMigration=0
|
||||
else
|
||||
checkBatchedBackgroundMigration=0;
|
||||
checkBatchedBackgroundMigration=0
|
||||
checkBackgroundMigration=1
|
||||
fi
|
||||
|
||||
counter=0
|
||||
while [ $checkBackgroundMigration -eq 1 ] || [ $checkDBBackgroundMigration -ge 1 ] || [ $checkBatchedBackgroundMigration -eq 1 ]
|
||||
while [ $checkBackgroundMigration -eq 1 ] || [ $checkBatchedBackgroundMigration -eq 1 ]
|
||||
do
|
||||
counter=$((counter + 1))
|
||||
if [ $counter -gt 1200 ]
|
||||
|
@ -207,20 +197,12 @@ then
|
|||
break
|
||||
fi
|
||||
|
||||
if [ $checkBackgroundMigration -eq 1 ] && gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining' | grep -q -w 0
|
||||
if [ $checkBackgroundMigration -eq 1 ] && ((gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining' | grep -q -w 0) || (gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigration::BatchedMigration.queued.count' | grep -q -w 0))
|
||||
then
|
||||
checkBackgroundMigration=0
|
||||
fi
|
||||
|
||||
if [ $checkDBBackgroundMigration -eq 2 ] && gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigration::BatchedMigration.queued.count' | grep -q -w 0
|
||||
then
|
||||
checkDBBackgroundMigration=0
|
||||
elif [ $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
|
||||
if [ $checkBatchedBackgroundMigration -eq 1 ] && gitlab-psql -c "SELECT job_class_name, table_name, column_name, job_arguments FROM batched_background_migrations WHERE status NOT IN(3, 6);" | grep -q -w 0
|
||||
then
|
||||
checkBatchedBackgroundMigration=0
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue