lib: move forgejocli to the forgejo instance WORK_PATH
Instead of having it in $DIR so that there can be one forgejocli per forgejo instance.
This commit is contained in:
parent
2461666aca
commit
b62866f3ae
3 changed files with 22 additions and 16 deletions
|
@ -1,7 +1,9 @@
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
function doctor_run() {
|
function doctor_run() {
|
||||||
local version=$1
|
local config=$1
|
||||||
|
local base=$(work_path_base $config)
|
||||||
|
local work_path=$DIR/$base
|
||||||
|
|
||||||
$DIR/forgejocli doctor check --all # --log-file -
|
$work_path/forgejocli doctor check --all # --log-file -
|
||||||
}
|
}
|
||||||
|
|
14
lib/lib.sh
14
lib/lib.sh
|
@ -181,9 +181,10 @@ function start_forgejo_daemon() {
|
||||||
grep '' $work_path/log/*.log 2> /dev/null
|
grep '' $work_path/log/*.log 2> /dev/null
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "$binary --config $work_path/app.ini --work-path $work_path" '"$@"' > $DIR/forgejocli
|
echo "$binary --config $work_path/app.ini --work-path $work_path" '"$@"' > $work_path/forgejocli
|
||||||
chmod +x $DIR/forgejocli
|
chmod +x $work_path/forgejocli
|
||||||
create_user_and_login $version
|
cp -a $work_path/forgejocli $DIR/forgejocli # because setup-forgejo/forgejo-runner.sh expects it here
|
||||||
|
create_user_and_login $version $config
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_minio() {
|
function start_minio() {
|
||||||
|
@ -287,10 +288,13 @@ function reset_garage() {
|
||||||
|
|
||||||
function create_user_and_login() {
|
function create_user_and_login() {
|
||||||
local version=$1
|
local version=$1
|
||||||
|
local config=$2
|
||||||
|
|
||||||
|
local work_path=$DIR/$(work_path_base $config)
|
||||||
|
|
||||||
local email="$FORGEJO_USER@example.com"
|
local email="$FORGEJO_USER@example.com"
|
||||||
if ! $DIR/forgejocli admin user list | grep --quiet "$email" ; then
|
if ! $work_path/forgejocli admin user list | grep --quiet "$email" ; then
|
||||||
$DIR/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
$work_path/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
||||||
fi
|
fi
|
||||||
|
|
||||||
forgejo-curl.sh logout
|
forgejo-curl.sh logout
|
||||||
|
|
|
@ -4,7 +4,7 @@ UPGRADE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
function upgrade_reset() {
|
function upgrade_reset() {
|
||||||
local config=$1
|
local config=$1
|
||||||
reset_forgejo $UPGRADE_DIR/$config-app.ini
|
reset_forgejo $config
|
||||||
reset_minio
|
reset_minio
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ function cleanup_storage() {
|
||||||
|
|
||||||
function test_successful_upgrades() {
|
function test_successful_upgrades() {
|
||||||
stop
|
stop
|
||||||
for config in default ; do
|
for config in $UPGRADE_DIR/default-app.ini ; do
|
||||||
log_info "using $config app.ini"
|
log_info "using $config"
|
||||||
upgrade_reset $config
|
upgrade_reset $config
|
||||||
|
|
||||||
version=1.21
|
version=1.21
|
||||||
|
@ -36,7 +36,7 @@ function test_successful_upgrades() {
|
||||||
start $version
|
start $version
|
||||||
fixture_create
|
fixture_create
|
||||||
fixture_assert
|
fixture_assert
|
||||||
doctor_run $version
|
doctor_run $config
|
||||||
|
|
||||||
for version in $RELEASE_NUMBERS_AND_DEV ; do
|
for version in $RELEASE_NUMBERS_AND_DEV ; do
|
||||||
stop
|
stop
|
||||||
|
@ -44,7 +44,7 @@ function test_successful_upgrades() {
|
||||||
start $version
|
start $version
|
||||||
verify_storage
|
verify_storage
|
||||||
fixture_assert
|
fixture_assert
|
||||||
doctor_run $version
|
doctor_run $config
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ function start_gitea() {
|
||||||
|
|
||||||
function test_gitea_upgrades() {
|
function test_gitea_upgrades() {
|
||||||
stop
|
stop
|
||||||
for config in default ; do
|
for config in $UPGRADE_DIR/default-app.ini ; do
|
||||||
log_info "using $config app.ini"
|
log_info "using $config"
|
||||||
upgrade_reset $config
|
upgrade_reset $config
|
||||||
|
|
||||||
version=1.21.10
|
version=1.21.10
|
||||||
|
@ -79,7 +79,7 @@ function test_gitea_upgrades() {
|
||||||
start_gitea $version
|
start_gitea $version
|
||||||
fixture_create
|
fixture_create
|
||||||
fixture_assert
|
fixture_assert
|
||||||
doctor_run $version
|
doctor_run $config
|
||||||
|
|
||||||
for version in 7.0-test ; do
|
for version in 7.0-test ; do
|
||||||
stop
|
stop
|
||||||
|
@ -87,7 +87,7 @@ function test_gitea_upgrades() {
|
||||||
start $version
|
start $version
|
||||||
verify_storage
|
verify_storage
|
||||||
fixture_assert
|
fixture_assert
|
||||||
doctor_run $version
|
doctor_run $config
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue