From 17e6573e7f59a9336ed99f5f38153540fa431a42 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Mon, 18 Sep 2023 11:26:21 +0300 Subject: [PATCH] Allow to use single web instance for any repository --- .github/workflows/setup.sh | 2 +- docs/ahriman.application.handlers.rst | 8 + docs/ahriman.core.formatters.rst | 8 + docs/ahriman.models.rst | 8 + docs/ahriman.web.schemas.rst | 8 + docs/ahriman.web.views.v1.status.rst | 8 + docs/configuration.rst | 8 +- docs/faq.rst | 6 +- docs/migration.rst | 2 +- docs/setup.rst | 2 +- package/archlinux/PKGBUILD | 2 +- .../lib/systemd/system/ahriman-web.service | 12 + .../lib/systemd/system/ahriman-web@.service | 13 +- .../ahriman/templates/build-status.jinja2 | 36 ++- .../build-status/key-import-modal.jinja2 | 34 +-- .../templates/build-status/login-modal.jinja2 | 18 +- .../build-status/package-add-modal.jinja2 | 47 ++- .../build-status/package-info-modal.jinja2 | 8 +- .../build-status/package-rebuild-modal.jinja2 | 26 +- .../templates/build-status/table.jinja2 | 76 ++++- .../share/ahriman/templates/static/logo.svg | 70 +++++ .../templates/utils/bootstrap-scripts.jinja2 | 2 +- .../bash-completion/completions/_ahriman | 21 +- package/share/man/man1/ahriman.1 | 35 ++- package/share/zsh/site-functions/_ahriman | 20 +- src/ahriman/application/ahriman.py | 87 ++++-- .../application/application/application.py | 2 +- .../application/application_packages.py | 2 +- .../application/application_repository.py | 2 +- src/ahriman/application/handlers/__init__.py | 1 + src/ahriman/application/handlers/dump.py | 22 +- src/ahriman/application/handlers/handler.py | 110 +++---- .../application/handlers/repositories.py | 54 ++++ src/ahriman/application/handlers/search.py | 7 +- .../application/handlers/service_updates.py | 5 +- src/ahriman/application/handlers/setup.py | 8 +- src/ahriman/application/handlers/web.py | 24 +- src/ahriman/application/lock.py | 2 +- src/ahriman/core/alpm/remote/aur.py | 8 +- src/ahriman/core/alpm/remote/official.py | 8 +- .../core/alpm/remote/official_syncdb.py | 7 +- src/ahriman/core/alpm/remote/remote.py | 23 +- .../core/configuration/configuration.py | 29 +- src/ahriman/core/configuration/schema.py | 1 - .../database/operations/build_operations.py | 6 +- .../database/operations/logs_operations.py | 27 +- .../core/database/operations/operations.py | 3 +- .../database/operations/package_operations.py | 94 ++++-- src/ahriman/core/formatters/__init__.py | 1 + .../core/formatters/repository_printer.py | 53 ++++ src/ahriman/core/log/http_log_handler.py | 12 +- src/ahriman/core/log/log_loader.py | 7 +- src/ahriman/core/report/remote_call.py | 14 +- .../core/repository/repository_properties.py | 2 +- src/ahriman/core/repository/update_handler.py | 2 +- src/ahriman/core/spawn.py | 73 +++-- src/ahriman/core/status/client.py | 6 +- src/ahriman/core/status/watcher.py | 31 +- src/ahriman/core/status/web_client.py | 24 +- src/ahriman/core/upload/remote_service.py | 5 +- src/ahriman/models/package.py | 7 +- src/ahriman/models/process_status.py | 36 +++ src/ahriman/models/repository_id.py | 21 ++ src/ahriman/web/schemas/__init__.py | 1 + .../web/schemas/internal_status_schema.py | 13 +- src/ahriman/web/schemas/log_schema.py | 5 +- .../web/schemas/package_status_schema.py | 7 + src/ahriman/web/schemas/pagination_schema.py | 6 +- .../web/schemas/repository_id_schema.py | 35 +++ src/ahriman/web/views/base.py | 54 +++- src/ahriman/web/views/index.py | 13 +- src/ahriman/web/views/v1/service/add.py | 6 +- src/ahriman/web/views/v1/service/pgp.py | 6 +- src/ahriman/web/views/v1/service/rebuild.py | 6 +- src/ahriman/web/views/v1/service/remove.py | 6 +- src/ahriman/web/views/v1/service/request.py | 6 +- src/ahriman/web/views/v1/service/search.py | 2 +- src/ahriman/web/views/v1/service/update.py | 5 +- src/ahriman/web/views/v1/service/upload.py | 9 +- src/ahriman/web/views/v1/status/logs.py | 12 +- src/ahriman/web/views/v1/status/package.py | 16 +- src/ahriman/web/views/v1/status/packages.py | 15 +- .../web/views/v1/status/repositories.py | 65 ++++ src/ahriman/web/views/v1/status/status.py | 14 +- src/ahriman/web/views/v1/user/login.py | 2 +- src/ahriman/web/views/v2/status/logs.py | 7 +- src/ahriman/web/web.py | 27 +- .../application/test_application.py | 4 +- .../application/handlers/test_handler.py | 54 ++-- .../application/handlers/test_handler_dump.py | 46 +++ .../handlers/test_handler_repositories.py | 37 +++ .../handlers/test_handler_search.py | 4 +- .../handlers/test_handler_service_updates.py | 2 +- .../handlers/test_handler_setup.py | 12 +- .../application/handlers/test_handler_web.py | 28 +- tests/ahriman/application/test_ahriman.py | 289 ++++++++++-------- tests/ahriman/conftest.py | 19 +- tests/ahriman/core/alpm/remote/test_aur.py | 14 +- .../ahriman/core/alpm/remote/test_official.py | 16 +- .../core/alpm/remote/test_official_syncdb.py | 11 + .../core/configuration/test_configuration.py | 45 ++- .../operations/test_build_operations.py | 12 +- .../operations/test_logs_operations.py | 17 +- .../operations/test_package_operations.py | 52 ++-- tests/ahriman/core/formatters/conftest.py | 16 +- .../formatters/test_repository_printer.py | 15 + .../ahriman/core/log/test_http_log_handler.py | 23 +- tests/ahriman/core/log/test_log_loader.py | 12 +- tests/ahriman/core/report/test_remote_call.py | 12 +- .../core/repository/test_update_handler.py | 2 +- tests/ahriman/core/status/conftest.py | 3 +- tests/ahriman/core/status/test_client.py | 17 +- tests/ahriman/core/status/test_watcher.py | 37 +-- tests/ahriman/core/status/test_web_client.py | 29 +- tests/ahriman/core/test_spawn.py | 98 +++--- tests/ahriman/core/test_util.py | 1 + .../core/upload/test_remote_service.py | 18 +- tests/ahriman/models/test_migration.py | 34 --- tests/ahriman/models/test_migration_result.py | 34 +++ tests/ahriman/models/test_package.py | 5 +- tests/ahriman/models/test_process_status.py | 0 tests/ahriman/models/test_repository_id.py | 23 ++ tests/ahriman/web/conftest.py | 34 +-- .../web/schemas/test_repository_id_schema.py | 1 + tests/ahriman/web/test_web.py | 16 +- tests/ahriman/web/views/test_view_base.py | 53 +++- .../v1/service/test_view_v1_service_add.py | 5 +- .../service/test_view_v1_service_rebuild.py | 5 +- .../v1/service/test_view_v1_service_remove.py | 5 +- .../service/test_view_v1_service_request.py | 5 +- .../v1/service/test_view_v1_service_search.py | 2 +- .../v1/service/test_view_v1_service_update.py | 5 +- .../v1/status/test_view_v1_status_package.py | 29 +- .../test_view_v1_status_repositories.py | 37 +++ 134 files changed, 1984 insertions(+), 898 deletions(-) create mode 100644 package/lib/systemd/system/ahriman-web.service mode change 100644 => 120000 package/lib/systemd/system/ahriman-web@.service create mode 100644 package/share/ahriman/templates/static/logo.svg create mode 100644 src/ahriman/application/handlers/repositories.py create mode 100644 src/ahriman/core/formatters/repository_printer.py create mode 100644 src/ahriman/models/process_status.py create mode 100644 src/ahriman/web/schemas/repository_id_schema.py create mode 100644 src/ahriman/web/views/v1/status/repositories.py create mode 100644 tests/ahriman/application/handlers/test_handler_repositories.py create mode 100644 tests/ahriman/core/formatters/test_repository_printer.py create mode 100644 tests/ahriman/models/test_process_status.py create mode 100644 tests/ahriman/web/schemas/test_repository_id_schema.py create mode 100644 tests/ahriman/web/views/v1/status/test_view_v1_status_repositories.py diff --git a/.github/workflows/setup.sh b/.github/workflows/setup.sh index 0efece74..18e96b56 100755 --- a/.github/workflows/setup.sh +++ b/.github/workflows/setup.sh @@ -42,7 +42,7 @@ ahriman -a x86_64 -r "github" service-setup --packager "ahriman bot - {{ repository }} + ahriman @@ -16,7 +16,22 @@ {% include "utils/bootstrap-scripts.jinja2" %}
-

ahriman

+
@@ -31,28 +46,33 @@ - {% endif %} @@ -117,7 +137,7 @@ {% if auth.enabled %}