up
Some checks failed
api-governance / spectral-lint (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Some checks failed
api-governance / spectral-lint (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
This commit is contained in:
Binary file not shown.
@@ -288,8 +288,8 @@ def package_telemetry_bundle(staging_dir: Path) -> None:
|
||||
shutil.copy2(sha_path, telemetry_dir / sha_path.name)
|
||||
|
||||
|
||||
def scan_files(staging_dir: Path, exclude: Optional[set[str]] = None) -> list[OrderedDict[str, Any]]:
|
||||
entries: list[OrderedDict[str, Any]] = []
|
||||
def scan_files(staging_dir: Path, exclude: Optional[set[str]] = None) -> list[OrderedDict[str, Any]]:
|
||||
entries: list[OrderedDict[str, Any]] = []
|
||||
exclude = exclude or set()
|
||||
for path in sorted(staging_dir.rglob("*")):
|
||||
if not path.is_file():
|
||||
@@ -309,6 +309,24 @@ def scan_files(staging_dir: Path, exclude: Optional[set[str]] = None) -> list[Or
|
||||
return entries
|
||||
|
||||
|
||||
def summarize_counts(staging_dir: Path) -> Mapping[str, int]:
|
||||
def count_files(rel: str) -> int:
|
||||
root = staging_dir / rel
|
||||
if not root.exists():
|
||||
return 0
|
||||
return sum(1 for path in root.rglob("*") if path.is_file())
|
||||
|
||||
return {
|
||||
"cli": count_files("cli"),
|
||||
"taskPacksDocs": count_files("docs/task-packs"),
|
||||
"containers": count_files("containers"),
|
||||
"orchestrator": count_files("orchestrator"),
|
||||
"exportCenter": count_files("export-center"),
|
||||
"notifier": count_files("notifier"),
|
||||
"surfaceSecrets": count_files("surface-secrets"),
|
||||
}
|
||||
|
||||
|
||||
def copy_container_bundles(release_dir: Path, staging_dir: Path) -> None:
|
||||
"""Copy container air-gap bundles if present in the release directory."""
|
||||
candidates = [release_dir / "containers", release_dir / "images"]
|
||||
@@ -473,8 +491,8 @@ def build_offline_kit(args: argparse.Namespace) -> MutableMapping[str, Any]:
|
||||
if manifest_sig:
|
||||
signature_paths["manifestSignature"] = str(manifest_sig)
|
||||
|
||||
metadata = OrderedDict(
|
||||
(
|
||||
metadata = OrderedDict(
|
||||
(
|
||||
("bundleId", args.bundle_id or f"{args.version}-{args.channel}-{utc_now_iso()}"),
|
||||
("bundleName", bundle_path.name),
|
||||
("bundleSha256", bundle_sha_prefixed),
|
||||
@@ -483,10 +501,11 @@ def build_offline_kit(args: argparse.Namespace) -> MutableMapping[str, Any]:
|
||||
("manifestSha256", f"sha256:{offline_manifest_sha}"),
|
||||
("manifestSize", offline_manifest_path.stat().st_size),
|
||||
("channel", args.channel),
|
||||
("version", args.version),
|
||||
("capturedAt", utc_now_iso()),
|
||||
)
|
||||
)
|
||||
("version", args.version),
|
||||
("capturedAt", utc_now_iso()),
|
||||
("counts", summarize_counts(staging_dir)),
|
||||
)
|
||||
)
|
||||
|
||||
if sig:
|
||||
metadata["bundleSignatureName"] = Path(sig).name
|
||||
|
||||
@@ -305,10 +305,17 @@ class OfflineKitBuilderTests(unittest.TestCase):
|
||||
self.assertTrue(any(item["name"].startswith("sboms/") for item in artifacts))
|
||||
self.assertTrue(any(item["name"].startswith("cli/") for item in artifacts))
|
||||
|
||||
metadata_path = Path(result["metadataPath"])
|
||||
data = json.loads(metadata_path.read_text(encoding="utf-8"))
|
||||
self.assertTrue(data["bundleSha256"].startswith("sha256:"))
|
||||
self.assertTrue(data["manifestSha256"].startswith("sha256:"))
|
||||
metadata_path = Path(result["metadataPath"])
|
||||
data = json.loads(metadata_path.read_text(encoding="utf-8"))
|
||||
self.assertTrue(data["bundleSha256"].startswith("sha256:"))
|
||||
self.assertTrue(data["manifestSha256"].startswith("sha256:"))
|
||||
counts = data["counts"]
|
||||
self.assertGreaterEqual(counts["cli"], 1)
|
||||
self.assertGreaterEqual(counts["containers"], 1)
|
||||
self.assertGreaterEqual(counts["orchestrator"], 2)
|
||||
self.assertGreaterEqual(counts["exportCenter"], 1)
|
||||
self.assertGreaterEqual(counts["notifier"], 1)
|
||||
self.assertGreaterEqual(counts["surfaceSecrets"], 1)
|
||||
|
||||
with tarfile.open(bundle_path, "r:gz") as tar:
|
||||
members = tar.getnames()
|
||||
|
||||
Reference in New Issue
Block a user