35 lines
934 B
Python
35 lines
934 B
Python
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from django.http import JsonResponse
|
|
|
|
|
|
def build_probe_view(service: str):
|
|
info_path = Path("/app/__buildinfo__.json")
|
|
fingerprint_path = Path("/app/__buildfingerprint__")
|
|
info = {}
|
|
if info_path.exists():
|
|
try:
|
|
info = json.loads(info_path.read_text())
|
|
except Exception:
|
|
info = {}
|
|
fingerprint = ""
|
|
if fingerprint_path.exists():
|
|
try:
|
|
fingerprint = fingerprint_path.read_text().strip()
|
|
except Exception:
|
|
fingerprint = ""
|
|
|
|
return JsonResponse(
|
|
{
|
|
"ok": True,
|
|
"service": service,
|
|
"build_id": info.get("build_id", ""),
|
|
"built_at_utc": info.get("built_at_utc", ""),
|
|
"image_marker": info.get("image_marker", ""),
|
|
"fingerprint": fingerprint,
|
|
"hostname": os.getenv("HOSTNAME", ""),
|
|
}
|
|
)
|