Qualify the standalone Core runtime lock used by Docker
Device Core qualification / qualify (push) Successful in 5m54s
Device Core qualification / qualify (push) Successful in 5m54s
This commit is contained in:
+19
-1
@@ -7,8 +7,10 @@ import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
|
||||
@@ -30,9 +32,11 @@ def run(args, cwd, capture=False, capture_errors=False):
|
||||
).stdout
|
||||
|
||||
|
||||
def install_dependencies(cwd):
|
||||
def install_dependencies(cwd, *, production=False):
|
||||
"""Retry only explicit transport failures in a disposable npm ci checkout."""
|
||||
command = ["npm", "ci", "--ignore-scripts", "--no-audit", "--no-fund"]
|
||||
if production:
|
||||
command.append("--omit=dev")
|
||||
transient = {"ECONNRESET", "ETIMEDOUT", "EAI_AGAIN"}
|
||||
for attempt in range(1, 4):
|
||||
try:
|
||||
@@ -51,6 +55,17 @@ def install_dependencies(cwd):
|
||||
return
|
||||
|
||||
|
||||
def qualify_core_runtime(root):
|
||||
"""Exercise the standalone lock used by Docker, outside npm workspaces."""
|
||||
with tempfile.TemporaryDirectory(prefix="device-core-runtime-") as temporary:
|
||||
target = Path(temporary)
|
||||
for name in ("package.json", "package-lock.json"):
|
||||
shutil.copyfile(root / "services/device-control-core" / name, target / name)
|
||||
install_dependencies(target, production=True)
|
||||
run(["node", "--input-type=module", "-e",
|
||||
"await import('oauth4webapi'); await import('pg');"], target)
|
||||
|
||||
|
||||
def read_lock(root):
|
||||
lock = json.loads((root / "infra/ci/sources.lock.json").read_text())
|
||||
if lock.get("schema") != "nodedc.device-core.ci-sources.v1":
|
||||
@@ -151,6 +166,9 @@ def qualify(root, commit, lock, report):
|
||||
print("ci_step=" + name, flush=True)
|
||||
if name in ("design-install", "device-install"):
|
||||
install_dependencies(cwd)
|
||||
if name == "device-install":
|
||||
print("ci_dependency_check=core-standalone-runtime", flush=True)
|
||||
qualify_core_runtime(root)
|
||||
else:
|
||||
run(command, cwd)
|
||||
completed.append(name)
|
||||
|
||||
Reference in New Issue
Block a user