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
|
||||
|
||||
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
|
||||
return 1
|
||||
fi
|
||||
echo "$binary --config $work_path/app.ini --work-path $work_path" '"$@"' > $DIR/forgejocli
|
||||
chmod +x $DIR/forgejocli
|
||||
create_user_and_login $version
|
||||
echo "$binary --config $work_path/app.ini --work-path $work_path" '"$@"' > $work_path/forgejocli
|
||||
chmod +x $work_path/forgejocli
|
||||
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() {
|
||||
|
@ -287,10 +288,13 @@ function reset_garage() {
|
|||
|
||||
function create_user_and_login() {
|
||||
local version=$1
|
||||
local config=$2
|
||||
|
||||
local work_path=$DIR/$(work_path_base $config)
|
||||
|
||||
local email="$FORGEJO_USER@example.com"
|
||||
if ! $DIR/forgejocli admin user list | grep --quiet "$email" ; then
|
||||
$DIR/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
||||
if ! $work_path/forgejocli admin user list | grep --quiet "$email" ; then
|
||||
$work_path/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
||||
fi
|
||||
|
||||
forgejo-curl.sh logout
|
||||
|
|
|
@ -4,7 +4,7 @@ UPGRADE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
|
||||
function upgrade_reset() {
|
||||
local config=$1
|
||||
reset_forgejo $UPGRADE_DIR/$config-app.ini
|
||||
reset_forgejo $config
|
||||
reset_minio
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ function cleanup_storage() {
|
|||
|
||||
function test_successful_upgrades() {
|
||||
stop
|
||||
for config in default ; do
|
||||
log_info "using $config app.ini"
|
||||
for config in $UPGRADE_DIR/default-app.ini ; do
|
||||
log_info "using $config"
|
||||
upgrade_reset $config
|
||||
|
||||
version=1.21
|
||||
|
@ -36,7 +36,7 @@ function test_successful_upgrades() {
|
|||
start $version
|
||||
fixture_create
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
doctor_run $config
|
||||
|
||||
for version in $RELEASE_NUMBERS_AND_DEV ; do
|
||||
stop
|
||||
|
@ -44,7 +44,7 @@ function test_successful_upgrades() {
|
|||
start $version
|
||||
verify_storage
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
doctor_run $config
|
||||
done
|
||||
done
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ function start_gitea() {
|
|||
|
||||
function test_gitea_upgrades() {
|
||||
stop
|
||||
for config in default ; do
|
||||
log_info "using $config app.ini"
|
||||
for config in $UPGRADE_DIR/default-app.ini ; do
|
||||
log_info "using $config"
|
||||
upgrade_reset $config
|
||||
|
||||
version=1.21.10
|
||||
|
@ -79,7 +79,7 @@ function test_gitea_upgrades() {
|
|||
start_gitea $version
|
||||
fixture_create
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
doctor_run $config
|
||||
|
||||
for version in 7.0-test ; do
|
||||
stop
|
||||
|
@ -87,7 +87,7 @@ function test_gitea_upgrades() {
|
|||
start $version
|
||||
verify_storage
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
doctor_run $config
|
||||
done
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue