feat: add build fingerprint generation and expose it in build probe response
This commit is contained in:
@@ -26,6 +26,7 @@ COPY federation_authority /app/federation_authority
|
|||||||
COPY provider /app/provider
|
COPY provider /app/provider
|
||||||
COPY relying_party /app/relying_party
|
COPY relying_party /app/relying_party
|
||||||
|
|
||||||
|
RUN sh -lc 'find /app/federation_authority /app/provider /app/relying_party /app/scripts -type f | sort | xargs sha256sum | sha256sum | awk "{print \$1}" > /app/__buildfingerprint__'
|
||||||
RUN printf '{\"build_id\":\"%s\",\"built_at_utc\":\"%s\",\"image_marker\":\"cie-auth-image\"}\n' \"$BUILD_ID\" \"$BUILD_TIME_UTC\" > /app/__buildinfo__.json
|
RUN printf '{\"build_id\":\"%s\",\"built_at_utc\":\"%s\",\"image_marker\":\"cie-auth-image\"}\n' \"$BUILD_ID\" \"$BUILD_TIME_UTC\" > /app/__buildinfo__.json
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|||||||
@@ -7,12 +7,19 @@ from django.http import JsonResponse
|
|||||||
|
|
||||||
def build_probe_view(service: str):
|
def build_probe_view(service: str):
|
||||||
info_path = Path("/app/__buildinfo__.json")
|
info_path = Path("/app/__buildinfo__.json")
|
||||||
|
fingerprint_path = Path("/app/__buildfingerprint__")
|
||||||
info = {}
|
info = {}
|
||||||
if info_path.exists():
|
if info_path.exists():
|
||||||
try:
|
try:
|
||||||
info = json.loads(info_path.read_text())
|
info = json.loads(info_path.read_text())
|
||||||
except Exception:
|
except Exception:
|
||||||
info = {}
|
info = {}
|
||||||
|
fingerprint = ""
|
||||||
|
if fingerprint_path.exists():
|
||||||
|
try:
|
||||||
|
fingerprint = fingerprint_path.read_text().strip()
|
||||||
|
except Exception:
|
||||||
|
fingerprint = ""
|
||||||
|
|
||||||
return JsonResponse(
|
return JsonResponse(
|
||||||
{
|
{
|
||||||
@@ -21,6 +28,7 @@ def build_probe_view(service: str):
|
|||||||
"build_id": info.get("build_id", ""),
|
"build_id": info.get("build_id", ""),
|
||||||
"built_at_utc": info.get("built_at_utc", ""),
|
"built_at_utc": info.get("built_at_utc", ""),
|
||||||
"image_marker": info.get("image_marker", ""),
|
"image_marker": info.get("image_marker", ""),
|
||||||
|
"fingerprint": fingerprint,
|
||||||
"hostname": os.getenv("HOSTNAME", ""),
|
"hostname": os.getenv("HOSTNAME", ""),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user