2024-03-17 16:26:17 +01:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2024-08-07 08:31:33 +02:00
|
|
|
UPGRADE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2024-03-17 16:26:17 +01:00
|
|
|
|
|
|
|
function upgrade_reset() {
|
|
|
|
local config=$1
|
2024-06-04 14:41:56 +02:00
|
|
|
reset_forgejo $config
|
2024-03-17 16:26:17 +01:00
|
|
|
reset_minio
|
|
|
|
}
|
|
|
|
|
|
|
|
function verify_storage() {
|
|
|
|
local work_path=$DIR/forgejo-work-path
|
|
|
|
|
2024-08-07 08:31:33 +02:00
|
|
|
for path in ${STORAGE_PATHS}; do
|
2024-03-17 16:26:17 +01:00
|
|
|
test -d $work_path/data/$path
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function cleanup_storage() {
|
|
|
|
local work_path=$DIR/forgejo-work-path
|
|
|
|
|
2024-08-07 08:31:33 +02:00
|
|
|
for path in ${STORAGE_PATHS}; do
|
2024-03-17 16:26:17 +01:00
|
|
|
rm -fr $work_path/data/$path
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_successful_upgrades() {
|
2024-03-17 17:22:44 +01:00
|
|
|
stop
|
2024-08-07 08:31:33 +02:00
|
|
|
for config in $UPGRADE_DIR/default-app.ini; do
|
2024-06-04 14:41:56 +02:00
|
|
|
log_info "using $config"
|
2024-03-17 16:26:17 +01:00
|
|
|
upgrade_reset $config
|
|
|
|
|
2024-08-07 09:36:16 +02:00
|
|
|
version=7.0
|
2024-03-17 17:22:44 +01:00
|
|
|
log_info "run $version"
|
|
|
|
cleanup_storage
|
2024-06-22 11:40:33 +02:00
|
|
|
start $version
|
|
|
|
fixture_create
|
|
|
|
fixture_assert
|
|
|
|
doctor_run $config
|
2024-03-17 17:22:44 +01:00
|
|
|
|
2024-08-08 16:48:39 +02:00
|
|
|
for version in $RELEASE_NUMBERS; do
|
2024-03-17 17:22:44 +01:00
|
|
|
stop
|
2024-03-17 16:26:17 +01:00
|
|
|
log_info "run $version"
|
|
|
|
start $version
|
|
|
|
verify_storage
|
2024-06-22 11:40:33 +02:00
|
|
|
fixture_assert
|
|
|
|
doctor_run $config
|
2024-03-17 16:26:17 +01:00
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2024-12-22 12:48:09 +01:00
|
|
|
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 --fixed-strings 'serveInstalled() [W] Table' $logfile; then
|
|
|
|
echo "unexpected warnings in database migration"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-04-13 15:50:08 +02:00
|
|
|
function test_gitea_upgrades() {
|
2024-06-22 11:40:33 +02:00
|
|
|
local config=$UPGRADE_DIR/default-app.ini
|
|
|
|
(
|
2024-12-22 12:48:09 +01:00
|
|
|
echo gitea 1.21 forgejo 10.0
|
|
|
|
echo gitea 1.22 forgejo 10.0
|
2024-08-07 08:31:33 +02:00
|
|
|
) | while read gitea gitea_version forgejo forgejo_version; do
|
2024-06-22 11:40:33 +02:00
|
|
|
log_info "upgrading from Gitea $gitea_version to Forgejo $forgejo_version"
|
|
|
|
stop
|
2024-04-13 15:50:08 +02:00
|
|
|
upgrade_reset $config
|
|
|
|
|
2024-06-22 11:40:33 +02:00
|
|
|
log_info "run Gitea $gitea_version"
|
2024-04-13 15:50:08 +02:00
|
|
|
cleanup_storage
|
2024-06-22 11:40:33 +02:00
|
|
|
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
|
2024-12-22 12:48:09 +01:00
|
|
|
|
|
|
|
migration_assert
|
2024-04-13 15:50:08 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2024-04-01 01:47:56 +02:00
|
|
|
source $UPGRADE_DIR/test-pprof-upload.sh
|
2024-03-17 16:26:17 +01:00
|
|
|
|
|
|
|
function test_upgrades() {
|
|
|
|
run dependencies
|
|
|
|
|
|
|
|
run test_successful_upgrades
|
2024-04-01 01:47:56 +02:00
|
|
|
run test_forgejo_pprof
|
2024-04-13 15:50:08 +02:00
|
|
|
run test_gitea_upgrades
|
2024-03-17 16:26:17 +01:00
|
|
|
}
|