forked from mtusi2026/mtusi2026lab2
Validate lab 3 release with accepted load evidence
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""date: 2026-11-06T08:45:36.609630+00:00 commit: b063c8780eabf63cdb9da3802f82440750308d6b"""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
root = pathlib.Path(__file__).resolve().parents[2]
|
||||
expected = {
|
||||
str(p.relative_to(root / "src/messenger")): hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
for p in (root / "src/messenger").rglob("*.py")
|
||||
}
|
||||
command = "import pathlib,hashlib,json;root=pathlib.Path('/opt/venv/lib/python3.14/site-packages/messenger');print(json.dumps({str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in root.rglob('*.py')}))"
|
||||
images = ["sha256:6a77cf630ec0f95d833ba7ceab58253181609622623d4c926fc6891bea55546f"]
|
||||
for index, image in enumerate(images):
|
||||
actual = json.loads(
|
||||
subprocess.check_output(
|
||||
[
|
||||
"docker",
|
||||
"run",
|
||||
"--rm",
|
||||
"--network",
|
||||
"none",
|
||||
"--read-only",
|
||||
"--name",
|
||||
f"hlpipe-lab3-image-audit-{index}",
|
||||
"--entrypoint",
|
||||
"python",
|
||||
image,
|
||||
"-c",
|
||||
command,
|
||||
],
|
||||
text=True,
|
||||
)
|
||||
)
|
||||
assert expected == actual
|
||||
print(
|
||||
json.dumps(
|
||||
{"image": image, "python_files": len(actual), "source_sha256_matches_checkout": True}
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user