Merge pull request #105 from YunoHost-Apps/testing

Automated testing -> master
This commit is contained in:
Josue-T 2024-06-28 00:21:54 +02:00 committed by GitHub
commit 8e0b424ee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 55 additions and 56 deletions

View File

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**Shipped version:** 1.21.5~ynh1 **Shipped version:** 1.22.0~ynh1
## Screenshots ## Screenshots

View File

@ -19,7 +19,7 @@ No se debe editar a mano.
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**Versión actual:** 1.21.5~ynh1 **Versión actual:** 1.22.0~ynh1
## Capturas ## Capturas

View File

@ -19,7 +19,7 @@ EZ editatu eskuz.
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**Paketatutako bertsioa:** 1.21.5~ynh1 **Paketatutako bertsioa:** 1.22.0~ynh1
## Pantaila-argazkiak ## Pantaila-argazkiak

View File

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**Version incluse:** 1.21.5~ynh1 **Version incluse:** 1.22.0~ynh1
## Captures décran ## Captures décran

View File

@ -19,7 +19,7 @@ NON debe editarse manualmente.
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**Versión proporcionada:** 1.21.5~ynh1 **Versión proporcionada:** 1.22.0~ynh1
## Capturas de pantalla ## Capturas de pantalla

View File

@ -19,7 +19,7 @@
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub.
**分发版本:** 1.21.5~ynh1 **分发版本:** 1.22.0~ynh1
## 截图 ## 截图

View File

@ -7,7 +7,7 @@ name = "Gitea"
description.en = "Lightweight Git forge" description.en = "Lightweight Git forge"
description.fr = "Forge Git légère" description.fr = "Forge Git légère"
version = "1.21.5~ynh1" version = "1.22.0~ynh1"
maintainers = ["Josué Tille"] maintainers = ["Josué Tille"]
# previous_maintainers = [ # previous_maintainers = [
@ -32,7 +32,8 @@ architectures = [
] ]
multi_instance = true multi_instance = true
ldap = true ldap = true
sso = true # reverse proxy authentication disabled until https://github.com/go-gitea/gitea/pull/18452 is merged
sso = false
disk = "120M" disk = "120M"
ram.build = "0M" ram.build = "0M"
ram.runtime = "100M" ram.runtime = "100M"
@ -66,14 +67,14 @@ ram.runtime = "100M"
extract = false extract = false
rename = "gitea" rename = "gitea"
armhf.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-arm-6" armhf.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-arm-6"
armhf.sha256 = "a531726f695aeb6bed4d69827e56e78e22fd0e4134b02b08edbc31c50c7e8735" armhf.sha256 = "a3881b9d065977923c5646547f1e80e71cffa503d81f08d70ec0419556ffd402"
arm64.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-arm64" arm64.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-arm64"
arm64.sha256 = "55d132cfb7016984773029abc8d1d8e9d844138f5e4c8ff8df273b55aa2190f3" arm64.sha256 = "ef6afed370b14d33b2b8dcc0c7ea56105b73ce9a3361090708985a878475d94b"
i386.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-386" i386.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-386"
i386.sha256 = "fbfde0506c100cc5e86a42c4eb73907d37be417df493a9b57400a0df55cafb14" i386.sha256 = "b320cf3a853389b3159ccd611af3bd9f4d96b843bf8eda67613760aa8d566d4d"
amd64.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-amd64" amd64.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-amd64"
amd64.sha256 = "7a521914203b07c7a0613ae30d8ab229111b149a2fa219423e643cd9a039256e" amd64.sha256 = "a31086f073cb9592d28611394b2de3655db515d961e4fdcf5b549cb40753ef3d"
autoupdate.strategy = "latest_github_release" autoupdate.strategy = "latest_github_release"
autoupdate.asset.armhf = "^gitea-.*-linux-arm-6$" autoupdate.asset.armhf = "^gitea-.*-linux-arm-6$"

View File

@ -3,7 +3,7 @@
#================================================= #=================================================
systemd_match_start_line='Starting new Web server: tcp:127.0.0.1:' systemd_match_start_line='Starting new Web server: tcp:127.0.0.1:'
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ssh_port="$(yunohost settings get security.ssh.ssh_port)"
#================================================= #=================================================
# DEFINE ALL COMMON FONCTIONS # DEFINE ALL COMMON FONCTIONS
@ -15,10 +15,10 @@ _set_permissions() {
chmod +x "$install_dir/gitea" chmod +x "$install_dir/gitea"
chown -R "$app:$app" "$data_dir" chown -R "$app:$app" "$data_dir"
find $data_dir \( \! -perm -o= \ find "$data_dir" \( \! -perm -o= \
-o \! -user $app \ -o \! -user "$app" \
-o \! -group $app \) \ -o \! -group "$app" \) \
-exec chown $app:$app {} \; \ -exec chown "$app:$app" {} \; \
-exec chmod u=rwX,g=rX,o= {} \; -exec chmod u=rwX,g=rX,o= {} \;
chmod -R u=rwX,g=,o= "$data_dir/.ssh" chmod -R u=rwX,g=,o= "$data_dir/.ssh"

View File

@ -9,7 +9,7 @@ source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
if [[ ! "$(systemctl status $app.service)" =~ 'Active: inactive (dead)' ]]; then if systemctl is-active "$app".service --quiet; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
fi fi
@ -19,23 +19,23 @@ fi
ynh_print_info --message='Declaring files to be backed up...' ynh_print_info --message='Declaring files to be backed up...'
# Copy the app source files # Copy the app source files
ynh_backup --src_path "$install_dir" ynh_backup --src_path="$install_dir"
# Copy the data files # Copy the data files
ynh_backup --src_path "$data_dir" --is_big=1 ynh_backup --src_path="$data_dir" --is_big=1
# Copy the conf files # Copy the conf files
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path "/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
# Backup logs # Backup logs
ynh_backup --src_path "/var/log/$app" ynh_backup --src_path="/var/log/$app"
# Dump the database # Dump the database
ynh_print_info --message="Backing up the MySQL database" ynh_print_info --message="Backing up the MySQL database"

View File

@ -17,10 +17,10 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message='Creating base directory...' ynh_script_progression --message='Creating base directory...'
if [ -n "$(ls -A $data_dir)" ]; then if [ -n "$(ls -A "$data_dir")" ]; then
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path"
mkdir -p $old_data_dir_path mkdir -p "$old_data_dir_path"
mv -t "$old_data_dir_path" "$data_dir"/* mv -t "$old_data_dir_path" "$data_dir"/*
fi fi
@ -42,15 +42,15 @@ _set_permissions
ynh_script_progression --message="Configuring application, step 1/2..." ynh_script_progression --message="Configuring application, step 1/2..."
internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) internal_token="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN)"
secret_key=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY) secret_key="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY)"
lfs_jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) lfs_jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)"
jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)"
ynh_app_setting_set --app="$app" --key=internal_token --value="$internal_token" ynh_app_setting_set --app="$app" --key=internal_token --value="$internal_token"
ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key" ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key"
ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret" ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret"
ynh_app_setting_set --app "$app" --key jwt_secret --value="$jwt_secret" ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
ynh_add_config --template='app.ini' --destination="$install_dir/custom/conf/app.ini" ynh_add_config --template='app.ini' --destination="$install_dir/custom/conf/app.ini"
@ -69,7 +69,7 @@ ynh_add_systemd_config
yunohost service add "$app" --log="/var/log/$app/gitea.log" yunohost service add "$app" --log="/var/log/$app/gitea.log"
# Configure logrotate # Configure logrotate
ynh_use_logrotate --logfile "/var/log/$app" ynh_use_logrotate --logfile="/var/log/$app"
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex='.*Failed authentication attempt for .* from <HOST>' --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex='.*Failed authentication attempt for .* from <HOST>' --max_retry=5

View File

@ -26,9 +26,6 @@ ynh_remove_logrotate
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
ynh_script_progression --message='Removing logs...'
ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View File

@ -34,7 +34,7 @@ yunohost service add "$app" --log="/var/log/$app/gitea.log"
# SETUP FAIL2BAN # SETUP FAIL2BAN
ynh_script_progression --message="Configuring fail2ban..." ynh_script_progression --message="Configuring fail2ban..."
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5 ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>" --max_retry=5
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View File

@ -9,7 +9,7 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed) upgrade_type="$(ynh_check_app_version_changed)"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -18,11 +18,11 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message='Ensuring downward compatibility...' --weight=1 ynh_script_progression --message='Ensuring downward compatibility...' --weight=1
if ynh_compare_current_package_version --comparison lt --version "1.6.4~ynh1"; then if ynh_compare_current_package_version --comparison=lt --version="1.6.4~ynh1"; then
message="Upgrade from $YNH_APP_CURRENT_VERSION was dropped. You need to run this, then upgrade to the latest version: message="Upgrade from $YNH_APP_CURRENT_VERSION was dropped. You need to run this, then upgrade to the latest version:
sudo yunohost app upgrade $app -u https://github.com/YunoHost-Apps/gitea_ynh/commit/a9ceb157032ae2290e944c1d0a255451ff2d133d" sudo yunohost app upgrade $app -u https://github.com/YunoHost-Apps/gitea_ynh/commit/a9ceb157032ae2290e944c1d0a255451ff2d133d"
ynh_print_info "$message" ynh_print_info "$message"
ynh_die --message="$message" --ret_code 1 ynh_die --message="$message" --ret_code=1
fi fi
#================================================= #=================================================
@ -53,8 +53,9 @@ if [ ~"$app" != "$data_dir" ]; then
usermod --home "$data_dir" "$app" usermod --home "$data_dir" "$app"
fi fi
# Ensure secrets are defined if [ "$upgrade_type" == UPGRADE_APP ]; then
ynh_setup_source --dest_dir="$install_dir" --source_id=main ynh_setup_source --dest_dir="$install_dir" --source_id=main --full_replace=1 --keep=custom
fi
#================================================= #=================================================
# MIGRATION STEP 2 (Set undefined Vars) # MIGRATION STEP 2 (Set undefined Vars)
@ -68,36 +69,36 @@ chmod -R u=rwX,g=rX,o= "$install_dir"
chmod +x "$install_dir/gitea" chmod +x "$install_dir/gitea"
if [[ -z "${internal_token:-}" ]]; then if [[ -z "${internal_token:-}" ]]; then
internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) internal_token="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN)"
ynh_app_setting_set --app "$app" --key internal_token --value="$internal_token" ynh_app_setting_set --app="$app" --key=internal_token --value="$internal_token"
fi fi
if [[ -z "${secret_key:-}" ]]; then if [[ -z "${secret_key:-}" ]]; then
secret_key=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY) secret_key="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY)"
ynh_app_setting_set --app "$app" --key secret_key --value="$secret_key" ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key"
fi fi
if [[ -n "${lfs_key:-}" ]]; then if [[ -n "${lfs_key:-}" ]]; then
lfs_jwt_secret="$lfs_key" lfs_jwt_secret="$lfs_key"
ynh_app_setting_delete --app "$app" --key lfs_key ynh_app_setting_delete --app="$app" --key=lfs_key
ynh_app_setting_set --app "$app" --key lfs_jwt_secret --value="$lfs_jwt_secret" ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret"
fi fi
if [[ -z "${lfs_jwt_secret:-}" ]]; then if [[ -z "${lfs_jwt_secret:-}" ]]; then
lfs_jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) lfs_jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)"
ynh_app_setting_set --app "$app" --key lfs_jwt_secret --value="$lfs_jwt_secret" ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret"
fi fi
if [[ -z "${jwt_secret:-}" ]]; then if [[ -z "${jwt_secret:-}" ]]; then
jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)"
ynh_app_setting_set --app "$app" --key jwt_secret --value="$jwt_secret" ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
fi fi
#================================================= #=================================================
# MIGRATION STEP Fix regression linked to 77c3678 and #76 # MIGRATION STEP Fix regression linked to 77c3678 and #76
#================================================= #=================================================
list_param_sql=$(yunohost user list --output-as json | jq -c '.users | keys' | sed 's|\[|\(|' | sed 's|\]|\)|') list_param_sql="$(yunohost user list --output-as json | jq -c '.users | keys' | sed 's|\[|\(|' | sed 's|\]|\)|')"
ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file=./fix_user_db_for_local_users.sql ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file=./fix_user_db_for_local_users.sql
ynh_replace_string --match_string=__USER_LIST__ --replace_string="$list_param_sql" --target_file=./fix_user_db_for_local_users.sql ynh_replace_string --match_string=__USER_LIST__ --replace_string="$list_param_sql" --target_file=./fix_user_db_for_local_users.sql
ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./fix_user_db_for_local_users.sql ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./fix_user_db_for_local_users.sql
@ -139,7 +140,7 @@ yunohost service add "$app" --log="/var/log/$app/gitea.log"
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>" --max_retry 5 ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>" --max_retry=5
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE