Revert 53375283d4
fix: alternative route of getting latest Gitea version
Use git ls-remote and git-mirror instead of the API
$ version=1.23
$ git ls-remote --refs --tags --sort=version:refname https://git-mirror.forgejo.org/go-gitea/gitea "v$version*" | sed -n -E -e "s|^.*/v($version[\.0-9]*)$|\1|p"
1.23.0
1.23.1
1.23.2
1.23.3
1.23.4
1.23.5
1.23.6
1.23.7
110 lines
2.6 KiB
Bash
Executable file
110 lines
2.6 KiB
Bash
Executable file
# SPDX-License-Identifier: MIT
|
|
|
|
UPGRADE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
function upgrade_reset() {
|
|
local config=$1
|
|
reset_forgejo $config
|
|
reset_minio
|
|
}
|
|
|
|
function verify_storage() {
|
|
local work_path=$DIR/forgejo-work-path
|
|
|
|
for path in ${STORAGE_PATHS}; do
|
|
test -d $work_path/data/$path
|
|
done
|
|
}
|
|
|
|
function cleanup_storage() {
|
|
local work_path=$DIR/forgejo-work-path
|
|
|
|
for path in ${STORAGE_PATHS}; do
|
|
rm -fr $work_path/data/$path
|
|
done
|
|
}
|
|
|
|
function test_successful_upgrades() {
|
|
stop
|
|
for config in $UPGRADE_DIR/default-app.ini; do
|
|
log_info "using $config"
|
|
upgrade_reset $config
|
|
|
|
set $RELEASE_NUMBERS
|
|
version="$1"
|
|
shift
|
|
log_info "run $version"
|
|
cleanup_storage
|
|
start $version
|
|
fixture_create
|
|
fixture_assert
|
|
doctor_run $config
|
|
|
|
for version in $@; do
|
|
stop
|
|
log_info "run $version"
|
|
start $version
|
|
verify_storage
|
|
fixture_assert
|
|
doctor_run $config
|
|
done
|
|
|
|
migration_assert
|
|
done
|
|
}
|
|
|
|
function migration_assert() {
|
|
local work_path=$DIR/forgejo-work-path
|
|
local logfile=$work_path/log/forgejo.log
|
|
|
|
grep --quiet 'ORM engine initialization successful' $logfile
|
|
if grep 'serveInstalled() \[[EW]\] Table' $logfile; then
|
|
echo "unexpected warnings in database initialization"
|
|
return 1
|
|
fi
|
|
if grep 'Migrate() \[[EW]\]' $logfile; then
|
|
echo "unexpected warnings in database migration"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
function test_gitea_upgrades() {
|
|
local config=$UPGRADE_DIR/default-app.ini
|
|
# The Forgejo target migration version must be 10.0 because it is the last supported.
|
|
# https://forgejo.org/2024-12-gitea-compatibility/
|
|
(
|
|
echo gitea 1.21 forgejo 10.0
|
|
echo gitea 1.22 forgejo 10.0
|
|
) | while read gitea gitea_version forgejo forgejo_version; do
|
|
log_info "upgrading from Gitea $gitea_version to Forgejo $forgejo_version"
|
|
stop
|
|
upgrade_reset $config
|
|
|
|
log_info "run Gitea $gitea_version"
|
|
cleanup_storage
|
|
start_s3 minio
|
|
start_gitea $gitea_version $config
|
|
fixture_create
|
|
fixture_assert
|
|
doctor_run $config
|
|
|
|
stop
|
|
log_info "run Forgejo $forgejo_version"
|
|
start $forgejo_version
|
|
verify_storage
|
|
fixture_assert
|
|
doctor_run $config
|
|
|
|
migration_assert
|
|
done
|
|
}
|
|
|
|
source $UPGRADE_DIR/test-pprof-upload.sh
|
|
|
|
function test_upgrades() {
|
|
run dependencies
|
|
|
|
run test_successful_upgrades
|
|
run test_forgejo_pprof
|
|
run test_gitea_upgrades
|
|
}
|