Added API call to build the Gitea runner debian package

This commit is contained in:
florian committed 2026-10-19 10:56:12 +02:00
1 parent 2ef26af317
commit bd2b0b601e
2 files changed
+40 -2

No files matched your search

+10 -2
View File
@@ -1,13 +1,14 @@
import asyncio
from contextlib import asynccontextmanager
import os
import uvicorn
from fastapi import Depends, FastAPI, HTTPException, Request
from db_module import close_connection_pool, create_connection_pool, get_db, start_healthcheck_thread
from feed_handler import grab_gitea_release_information, grab_royal_road_chapter_information
from feed_handler import grab_gitea_release_information, grab_royal_road_chapter_information, build_gitea_runner
from metrics_server import REQUEST_COUNTER, metrics_api
from secret_manager import cleanup_secret_files
from secret_manager import cleanup_secret_files, get_secret
from send_notifications import NotificationClient
from simple_logger_handler import LOG_LEVEL, setup_logger
@@ -18,6 +19,8 @@ logger = setup_logger(__name__)
async def lifespan(app: FastAPI):
logger.info("[FastAPI] Starting application...")
app.state.notifier = NotificationClient()
app.state.gitea_token = get_secret(os.getenv("GITEA_TOKEN",""),"/etc/secrets/gitea_token")
logger.info("[FastAPI] Creating MySQL connection pool...")
create_connection_pool("royalRoadPool")
@@ -25,6 +28,7 @@ async def lifespan(app: FastAPI):
logger.info("[FastAPI] MySQL healthcheck thread started.")
SECRET_PATHS = frozenset({
"/etc/secrets/gitea_token",
"/etc/secrets/api_key",
"/etc/secrets/db_username",
"/etc/secrets/db_password"
@@ -110,6 +114,10 @@ def get_release_information(request: Request, db = Depends(get_db)):
logger.debug(f"[FastAPI] Notification sent and database updated for Gitea feed ID {feed_id}")
results["new"] += 1
if link.startswith("https://gitea.com/gitea/runner/releases/tag/v"):
gitea_build_success = build_gitea_runner(release_title, request.app.state.gitea_token)
logger.info(f"[FastAPI] Gitea build ran successfully:{gitea_build_success}")
except Exception as e:
db.rollback()
results["errors"] += 1