Server providing interface between Packit and Log Detective using Fedora messaging infrastructure.
Requests sent to /analyze enpoint are routed to Log Detective server
with URL set by LD_URL environment variable. Eventual response is
posted on the public fedora messaging under logdetective.analysis topic,
with a unique build id to identify it for retrieval by Packit.
Should the analysis fail, for whatever reason, an error is posted to the same
logdetective.analysis topic.
The endpoint expects a JSON payload matching the BuildInfo model:
{
"logs": {
"builder-live.log": "http://example.com/builder-live.log",
"backend.log": "http://example.com/logs/123/backend.log"
},
"target_build": "12345",
"build_system": "copr",
"commit_sha": "9deb98c730bb4123f518ca13a0dbec5d7c0669ca",
"project_url": "www.logdetective.com",
"pr_id": 1
}
logs (dict): A dictionary mapping log filenames to their full URL.
target_build (str): A unique identifier for the build, which will be included in the message.
build_system (str): Name of the build system used, in practice either copr or koji
commit_sha (str): Hash of the commit from which the build was created
project_url (str): URL of the project the build is for
pr_id (int): Identifier of the pull request, or equivalent
Of these values, only logs are used by Log Detective itself.
The rest is used as part of a message sent to Fedora Messaging infrastructure,
to identify results.
Images are published to quay.io. If it isn't available, or if you want to test your own changes. First build your own image
podman build -t logdetective-packit .
and then run the container:
podman run -d --name logdetective-packit \
-p 8090:8090 \
-e LD_URL="https://logdetective.example.com/api" \
logdetective-packit:latest
The server/gunicorn.config.py sets port 8090 as a default, unless the PACKIT_INTERFACE_PORT is set.
For production deployment, use the PACKIT_INTERFACE_PORT variable, to set port for the server.
If the selected Log Detective server requires authentication, set the token with -e LD_TOKEN="your-token" option.
Certificates necessary for communication over public broker
are part of the image, being installed as part of fedora-messaging package.
Dependencies and local environment are best managed trough uv.
Installing the project and all dependencies locally with uv sync --locked --all-extras --dev.
This server should be kept as small and fast as possible. Processing of logs should all be done on the side of Log Detective server itself.
Tests should be executed with uv:
uv run pytest