Files
vpn-dns-gateway/ci/jenkins-capacity/inventory.py
billandClaude Opus 5.5 1149e9fbc3
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Document Assignment 6 Jenkins CI in the manual (refs #14)
Add the Continuous Integration with Jenkins chapter in the eight rubric
sections: deployment and persistence (capacity test, memory-limit fix,
restart test), HTTPS/access/firewall with IPv4 and IPv6 exposure checks,
webhook traceability with an actual deployment diagram, pipeline stages,
the required pr-main merge gate, PR #15's failure/repair/review/merge
sequence, credentials and controller build boundary, and controls.

Update the Hosts and Passwords tables (1 GiB resize, Jenkins and
ci.yebilly.me, jenkins-bot account and token hints), the title page,
abstract, Document History, glossary, and AI prompt log (including
Vincent's prepared Oct 19-21 record). Note that Assignment 5's PR #13
merged.

Also version pipeline-graph-view and its dependencies in the Jenkins
plugin lockfile, and add Vincent's source-only ci/jenkins-capacity test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:20:31 -04:00

40 lines
1.7 KiB
Python

"""Inspect downloaded plugin archives without loading Jenkins or reading secrets."""
import email.parser
import hashlib
import json
from pathlib import Path
import sys
import zipfile
def inventory(directory, requested):
entries = []
for path in sorted(Path(directory).glob("*.jpi")):
with zipfile.ZipFile(path) as archive:
raw = archive.read("META-INF/MANIFEST.MF").decode("utf-8")
# JAR manifests fold lines by prefixing continuation lines with one space.
unfolded = raw.replace("\r\n ", "").replace("\n ", "")
manifest = email.parser.Parser().parsestr(unfolded)
with path.open("rb") as stream:
digest = hashlib.file_digest(stream, "sha256").hexdigest() if hasattr(hashlib, "file_digest") else None
if digest is None:
h = hashlib.sha256()
with path.open("rb") as stream:
for block in iter(lambda: stream.read(1024 * 1024), b""):
h.update(block)
digest = h.hexdigest()
entries.append({"id": manifest["Short-Name"], "version": manifest["Plugin-Version"],
"requires_jenkins": manifest["Jenkins-Version"], "sha256": digest})
versions = {p["id"]: p["version"] for p in entries}
roots = [line.strip().split(":") for line in Path(requested).read_text().splitlines() if line.strip()]
for name, version in roots:
if versions.get(name) != version:
raise ValueError(f"Requested root version was not installed exactly: {name}:{version}")
if not entries:
raise ValueError("No plugin archives found")
return entries
if __name__ == "__main__":
print(json.dumps(inventory(sys.argv[1], sys.argv[2]), indent=2))