Skip to content

Commit

Permalink
GH-53: merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
zengxs committed Oct 30, 2023
1 parent 954ea16 commit 108c5db
Showing 1 changed file with 1 addition and 48 deletions.
49 changes: 1 addition & 48 deletions assets/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,6 @@ function detect_unclean_start() {
set -e
}

# Make sure that there is no unmigrated data to hashed storage.
function unmigrated_data_check() {
set +e

echo "Checking for unmigrated data on legacy storage"
found=$(MAX_DATABASE_CONNECTION_CHECKS=5 gitlab-rake gitlab:storage:legacy_attachments gitlab:storage:legacy_projects 2>&1);

if [ $? -ne 0 ]; then
echo "Upgrade failed. Could not check for unmigrated data on legacy storage."
echo ""
echo $found
echo ""
echo ""
echo "If you would like to restart the instance without performing this"
echo "check, add the following to your docker command:"
echo "-e GITLAB_SKIP_UNMIGRATED_DATA_CHECK=true"
echo ""
exit 1
fi

if ! (echo $found | grep 'Found 0 attachments' && echo $found | grep 'Found 0 projects') > /dev/null 2>&1; then
echo
echo "Legacy storage is no longer supported. Please migrate your data to hashed storage."
echo "Check https://docs.gitlab.com/ee/administration/raketasks/storage.html#migrate-to-hashed-storage for details."
echo ""
echo "Upgrade failed. Retry the upgrade after migrating your data to hashed storage."
exit 1
fi

set -e
}

trap "sigterm_handler; exit" TERM

source /RELEASE
Expand Down Expand Up @@ -119,7 +87,7 @@ if old_version=$(cat /var/opt/gitlab/gitlab-rails/VERSION)
then
GITLAB_UPGRADE='true'
new_version=$(awk '/^gitlab-(ce|ee|jh)/ {print $NF}' /opt/gitlab/version-manifest.txt)
MIN_VERSION="15.11" gitlab-ctl upgrade-check "${old_version}" "${new_version}"
gitlab-ctl upgrade-check "${old_version}" "${new_version}"
fi

# Copy gitlab.rb for the first time
Expand Down Expand Up @@ -179,21 +147,6 @@ GITLAB_OMNIBUS_CONFIG= /opt/gitlab/embedded/bin/runsvdir-start &
echo "Configuring GitLab..."
gitlab-ctl reconfigure

# Skip unmigrated data check if Puma and Sidekiq is not running
if [ ! -d /opt/gitlab/service/puma ] && [ ! -d /opt/gitlab/service/sidekiq ]; then
echo
echo "This node does not appear to be running puma and/or sidekiq services"
echo "Skipping unmigrated data check, if you think this is an error exit now"
echo

GITLAB_SKIP_UNMIGRATED_DATA_CHECK='true'
fi

# Check if there are no unmigrated data to hashed storage if it is an upgrade
if [ "${GITLAB_UPGRADE}" == 'true' -a "${GITLAB_SKIP_UNMIGRATED_DATA_CHECK}" != 'true' ]; then
unmigrated_data_check
fi

# This must be false when the opt-in PostgreSQL version is the default for pg-upgrade,
# otherwise it must be true.
ATTEMPT_AUTO_PG_UPGRADE='false'
Expand Down

0 comments on commit 108c5db

Please sign in to comment.