forked from NYANDEV/forgejo
[UPGRADE] add sanity check for v1.20.5-0
See https://forgejo.org/2023-10-release-v1-20-5-0/ (cherry picked from commit 7d619f79a0ebebf0de49be6175701769db04f7c2) (cherry picked from commit ce5c75e1532894c180c66c38f828fd647c3b8174) (cherry picked from commit 252c81f2bc16a3409c144fd5061c9c249af9be8d) (cherry picked from commit 552920251decd5a785076df22cb83b3317f8f437) (cherry picked from commit 15f1c851f0b83088e7c9ec815ee991a81ded94e9) (cherry picked from commit 9e542dcb302d5696b9fe2ea5889f641fd095c574)
This commit is contained in:
parent
f9a031ab16
commit
843f08fefd
1 changed files with 42 additions and 3 deletions
|
@ -42,12 +42,12 @@ function log_info() {
|
||||||
function dependencies() {
|
function dependencies() {
|
||||||
maybe_sudo
|
maybe_sudo
|
||||||
if ! which curl daemon jq git-lfs > /dev/null ; then
|
if ! which curl daemon jq git-lfs > /dev/null ; then
|
||||||
$SUDO apt-get install -y -qq curl daemon git-lfs jq
|
$SUDO apt-get install -y -qq curl daemon git-lfs jq sqlite3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio > /dev/null ; then
|
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio > /dev/null ; then
|
||||||
$SUDO curl --fail -sS https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
|
$SUDO curl --fail -sS https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
|
||||||
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2023-08-23T10-07-06Z -o /usr/local/bin/minio
|
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio
|
||||||
fi
|
fi
|
||||||
if ! test -x /usr/local/bin/mc || ! test -x /usr/local/bin/minio > /dev/null ; then
|
if ! test -x /usr/local/bin/mc || ! test -x /usr/local/bin/minio > /dev/null ; then
|
||||||
$SUDO chmod +x /usr/local/bin/mc
|
$SUDO chmod +x /usr/local/bin/mc
|
||||||
|
@ -101,7 +101,11 @@ function download() {
|
||||||
|
|
||||||
if ! test -f $DIR/forgejo-$version ; then
|
if ! test -f $DIR/forgejo-$version ; then
|
||||||
mkdir -p $DIR
|
mkdir -p $DIR
|
||||||
wget -O $DIR/forgejo-$version --quiet https://codeberg.org/forgejo/forgejo/releases/download/v$version/forgejo-$version-linux-amd64
|
for owner in forgejo forgejo-experimental forgejo-integration ; do
|
||||||
|
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$version/forgejo-$version-linux-amd64 ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
chmod +x $DIR/forgejo-$version
|
chmod +x $DIR/forgejo-$version
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -555,6 +559,40 @@ function test_successful_upgrades() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_forgejo_database_version() {
|
||||||
|
local expected_version=$1
|
||||||
|
local work_path=$DIR/forgejo-work-path
|
||||||
|
|
||||||
|
actual_version=$(sqlite3 $work_path/forgejo.db "select version from forgejo_version")
|
||||||
|
test "$expected_version" = "$actual_version"
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_forgejo_database_v3_upgrades_list_table() {
|
||||||
|
local table=$1
|
||||||
|
local work_path=$DIR/forgejo-work-path
|
||||||
|
|
||||||
|
sqlite3 $work_path/forgejo.db ".tables $table" .exit | grep --quiet $table
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_forgejo_database_v3_upgrades() {
|
||||||
|
local table=forgejo_auth_token
|
||||||
|
|
||||||
|
stop
|
||||||
|
|
||||||
|
reset default
|
||||||
|
log_info "run 1.20.4-1"
|
||||||
|
start 1.20.4-1
|
||||||
|
stop
|
||||||
|
! test_forgejo_database_v3_upgrades_list_table $table
|
||||||
|
test_forgejo_database_version 2
|
||||||
|
|
||||||
|
log_info "run 1.20.5-0"
|
||||||
|
start 1.20.5-0
|
||||||
|
stop
|
||||||
|
test_forgejo_database_v3_upgrades_list_table $table
|
||||||
|
test_forgejo_database_version 3
|
||||||
|
}
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
local fun=$1
|
local fun=$1
|
||||||
shift
|
shift
|
||||||
|
@ -585,6 +623,7 @@ function test_upgrades() {
|
||||||
run test_bug_storage_s3_misplace
|
run test_bug_storage_s3_misplace
|
||||||
run test_storage_stable_s3 minio
|
run test_storage_stable_s3 minio
|
||||||
run test_storage_stable_s3 garage
|
run test_storage_stable_s3 garage
|
||||||
|
run test_forgejo_database_v3_upgrades
|
||||||
}
|
}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
Loading…
Reference in a new issue