feat: enhance build process and Dockerfiles for improved artifact handling and dependency resolution

Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
d9pouces
2026-09-05 23:16:49 +02:00
parent 438fed1e96
commit 42e15a2d7e
6 changed files with 112 additions and 21 deletions
+19 -4
View File
@@ -9,6 +9,8 @@ can run in a minimal Python image with nothing installed.
from __future__ import annotations
import hashlib
import io
import pathlib
import zipfile
@@ -32,19 +34,32 @@ POM = f"""<?xml version="1.0" encoding="UTF-8"?>
"""
def build_jar(path: pathlib.Path) -> None:
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as archive:
def build_jar() -> bytes:
buffer = io.BytesIO()
with zipfile.ZipFile(buffer, "w", zipfile.ZIP_DEFLATED) as archive:
archive.writestr("META-INF/MANIFEST.MF", MANIFEST)
archive.writestr(
"marker.txt",
"test-only artifact served by the id-configurator integration tests\n",
)
return buffer.getvalue()
def _write_with_checksums(path: pathlib.Path, content: bytes) -> None:
"""Write `content` to `path`, plus the .sha1/.md5 sidecar files most
build tools (Leiningen's aether resolver in particular) require to be
present, unlike Maven which merely warns when they are missing."""
path.write_bytes(content)
sha1_digest = hashlib.sha1(content).hexdigest() # nosec B324
(path.parent / f"{path.name}.sha1").write_text(sha1_digest, encoding="ascii")
md5_digest = hashlib.md5(content).hexdigest() # nosec B324
(path.parent / f"{path.name}.md5").write_text(md5_digest, encoding="ascii")
def main() -> None:
OUT_DIR.mkdir(parents=True, exist_ok=True)
build_jar(OUT_DIR / f"{ARTIFACT}-{VERSION}.jar")
(OUT_DIR / f"{ARTIFACT}-{VERSION}.pom").write_text(POM, encoding="utf-8")
_write_with_checksums(OUT_DIR / f"{ARTIFACT}-{VERSION}.jar", build_jar())
_write_with_checksums(OUT_DIR / f"{ARTIFACT}-{VERSION}.pom", POM.encode("utf-8"))
if __name__ == "__main__":