Merge pull request #11 from paveldhq/codex/hosted-cuda-package

Build CUDA release preview on an isolated hosted CPU runner
This commit is contained in:
Pavlo Ratushnyi
2026-10-04 22:52:17 +02:00
committed by GitHub
7 changed files with 440 additions and 1 deletions
+93
View File
@@ -11,6 +11,10 @@ on:
description: Run synthetic Keyless CUDA tests on the private GPU runner
type: boolean
default: false
hosted_cuda_package:
description: Build actual CUDA package on isolated hosted CPU (no GPU, private artifact)
type: boolean
default: false
static_cuda_package:
description: Build and audit static CUDA toolkit linkage on the private Linux runner (no inference)
type: boolean
@@ -94,6 +98,95 @@ jobs:
if: always()
run: rm -rf -- "${RUNNER_TEMP}/strata-static-cuda-${GITHUB_RUN_ID}" "${RUNNER_TEMP}/strata-package-build-${GITHUB_RUN_ID}"
hosted-cuda-package:
if: github.event_name == 'workflow_dispatch' && inputs.hosted_cuda_package && github.event.repository.private
needs: verify
runs-on: ubuntu-24.04
timeout-minutes: 150
env:
CUDA_VISIBLE_DEVICES: ''
BUILD_JOBS: '1'
CARGO_BUILD_JOBS: '2'
CUDA_ARCHITECTURES: '120'
steps:
- uses: actions/checkout@v4
- name: Install compatible host tools (no drivers)
run: |
echo "CUDACXX=$RUNNER_TEMP/strata-cuda-toolkit/bin/nvcc" >> "$GITHUB_ENV"
echo "CUDAToolkit_ROOT=$RUNNER_TEMP/strata-cuda-toolkit" >> "$GITHUB_ENV"
echo "STRATA_BUILD_DIR=$RUNNER_TEMP/strata-hosted-cuda-engine" >> "$GITHUB_ENV"
sudo apt-get update && sudo apt-get install -y gcc-13 g++-13 cmake ninja-build musl-tools binutils
- name: Assemble pinned build-only CUDA components
run: python3 scripts/bootstrap-cuda-toolkit.py --output "$CUDAToolkit_ROOT"
- name: Record actual toolchain
run: |
"$CUDACXX" --version
g++-13 --version
df -h "$RUNNER_TEMP"
free -h
python3 - <<'PYTOOL'
import json, os, platform, subprocess
from pathlib import Path
info=json.loads((Path(os.environ['CUDAToolkit_ROOT'])/'TOOLKIT-PROVENANCE.json').read_text())
info.update(source=os.environ['GITHUB_SHA'], runner_os=platform.platform(),
gcc=subprocess.check_output(['g++-13','--version'],text=True),
nvcc=subprocess.check_output([os.environ['CUDACXX'],'--version'],text=True),
cuda_architectures=os.environ['CUDA_ARCHITECTURES'], driver_tested=False, model_tested=False)
(Path(os.environ['RUNNER_TEMP'])/'CUDA-TOOLCHAIN.json').write_text(json.dumps(info,indent=2)+'\n')
PYTOOL
- name: Build actual static CUDA engine and audit without GPU
env:
CC: gcc-13
CXX: g++-13
CUDAHOSTCXX: g++-13
run: scripts/build-static-cuda.sh
- name: Install pinned Rust and musl target
run: |
rustup toolchain install 1.99.0 --profile minimal
rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl
- name: Assemble actual combined executable and runtime image
run: |
# Keep resource evidence even if the hosted runner terminates this job.
(while sleep 20; do
date -u
free -m
df -m "$RUNNER_TEMP"
test ! -r /sys/fs/cgroup/memory.events || cat /sys/fs/cgroup/memory.events
done) &
resource_sampler=$!
trap 'kill "$resource_sampler" 2>/dev/null || true; wait "$resource_sampler" 2>/dev/null || true' EXIT
engine="$STRATA_BUILD_DIR/strata"
package="$RUNNER_TEMP/strata-hosted-cuda-package"
/usr/bin/time -v python3 scripts/build-linux-package.py --engine "$engine" \
--sha256 "$(sha256sum "$engine" | cut -d ' ' -f 1)" --revision "$GITHUB_SHA" \
--cargo-target-dir "$RUNNER_TEMP/strata-hosted-package-build" --output "$package"
python3 scripts/build-runtime-image.py --package "$package" \
--receipt-sha256 "$(sha256sum "$package/SHA256SUMS" | cut -d ' ' -f 1)" \
> "$RUNNER_TEMP/strata-hosted-image.json"
image="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image"])' "$RUNNER_TEMP/strata-hosted-image.json")"
docker save --output "$package/runtime-image.tar" "$image"
cp "$RUNNER_TEMP/strata-hosted-image.json" "$package/IMAGE-PROVENANCE.json"
cp "$RUNNER_TEMP/CUDA-TOOLCHAIN.json" "$package/CUDA-TOOLCHAIN.json"
tar -C "$CUDAToolkit_ROOT" -cf "$package/CUDA-LICENSES.tar" licenses
(cd "$package" && sha256sum runtime-image.tar IMAGE-PROVENANCE.json CUDA-TOOLCHAIN.json CUDA-LICENSES.tar > IMAGE-SHA256SUMS)
- uses: actions/upload-artifact@v4
with:
name: strata-next-hosted-cuda-preview
path: ${{ runner.temp }}/strata-hosted-cuda-package/
if-no-files-found: error
retention-days: 7
- name: Remove uploaded package copy
run: rm -rf -- "$RUNNER_TEMP/strata-hosted-cuda-package"
- name: Remove owned intermediate image and build files
if: always()
run: |
receipt="$RUNNER_TEMP/strata-hosted-image.json"
if test -s "$receipt"; then
image="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image"])' "$receipt")"
docker image rm "$image"
fi
rm -rf -- "$RUNNER_TEMP/strata-cuda-toolkit" "$RUNNER_TEMP/strata-hosted-cuda-engine" "$RUNNER_TEMP/strata-hosted-package-build"
linux-static-cli:
needs: verify
runs-on: ubuntu-24.04
+35 -1
View File
@@ -71,10 +71,44 @@ fn embed_engine() -> Result<(), Box<dyn std::error::Error>> {
)?;
(digest.to_ascii_lowercase(), revision.to_ascii_lowercase())
};
let size = fs::metadata(&payload_path)?.len();
let declaration = if size == 0 {
"pub const BYTES: &[u8] = &[];\n".to_owned()
} else {
// Keep large verified payloads out of Rust constant evaluation/LLVM IR.
// The target assembler copies the bytes into an immutable ELF section.
let path = payload_path.to_str().ok_or("payload path must be UTF-8")?;
if path.contains(['\n', '\r']) {
return Err("payload path cannot contain newlines".into());
}
let path = path.replace('\\', "\\\\").replace('"', "\\\"");
let assembly = output.join("embedded-engine.S");
fs::write(
&assembly,
format!(
".section .rodata.strata_engine,\"a\"\n\
.balign 16\n\
.global strata_embedded_engine_bytes\n\
.hidden strata_embedded_engine_bytes\n\
strata_embedded_engine_bytes:\n\
.incbin \"{path}\"\n\
.size strata_embedded_engine_bytes, .-strata_embedded_engine_bytes\n\
.section .note.GNU-stack,\"\"\n"
),
)?;
cc::Build::new()
.file(assembly)
.compile("strata_embedded_payload");
format!(
"unsafe extern \"C\" {{ static strata_embedded_engine_bytes: [u8; {size}]; }}\n\
// SAFETY: build.rs emits exactly {size} verified bytes in read-only storage.\n\
pub static BYTES: &[u8] = unsafe {{ &strata_embedded_engine_bytes }};\n"
)
};
fs::write(
output.join("embedded-engine.rs"),
format!(
"pub const BYTES: &[u8] = include_bytes!(concat!(env!(\"OUT_DIR\"), \"/embedded-engine.bin\"));\n\
"{declaration}\
pub const SHA256: &str = {digest:?};\n\
pub const SOURCE_REVISION: &str = {revision:?};\n"
),
+63
View File
@@ -0,0 +1,63 @@
{
"release": "13.0.1",
"manifest_url": "https://developer.download.nvidia.com/compute/cuda/redist/redistrib_13.0.1.json",
"manifest_sha256": "9c494bc13b34e8fbcad083a6486d185b0906068b821722502edf9d0e3bd14096",
"components": [
{
"component": "cuda_nvcc",
"version": "13.0.88",
"relative_path": "cuda_nvcc/linux-x86_64/cuda_nvcc-linux-x86_64-13.0.88-archive.tar.xz",
"sha256": "48e35be3cfbf4b4fbc16828eaec8a7048ee789403049dc409f7b643d6259cf7a",
"md5": "e3e925c644055b9306aec9c9b84d1975",
"size": "26657716"
},
{
"component": "cuda_crt",
"version": "13.0.88",
"relative_path": "cuda_crt/linux-x86_64/cuda_crt-linux-x86_64-13.0.88-archive.tar.xz",
"sha256": "5a3279a049ffc1cdb951c44cb95206acfdde9e9ae5e87825fc18d7e4a6878bb0",
"md5": "f90b38d702a29668d97e8f94a399ea31",
"size": "79800"
},
{
"component": "cuda_cudart",
"version": "13.0.88",
"relative_path": "cuda_cudart/linux-x86_64/cuda_cudart-linux-x86_64-13.0.88-archive.tar.xz",
"sha256": "bc44226f069402ab327bcf9e754660621aa6bc61fb7fc6afe03b794dfaaab658",
"md5": "4ec0cce22fdbeeacb4bb406a800e27bc",
"size": "1491604"
},
{
"component": "cuda_cccl",
"version": "13.0.85",
"relative_path": "cuda_cccl/linux-x86_64/cuda_cccl-linux-x86_64-13.0.85-archive.tar.xz",
"sha256": "ed845eae8c1767706b6ee91e40c608a03f6f633551a849b63f7346d32d73ee60",
"md5": "c0dd26e0c41dc35bd73435a4799c7508",
"size": "991284"
},
{
"component": "cuda_culibos",
"version": "13.0.85",
"relative_path": "cuda_culibos/linux-x86_64/cuda_culibos-linux-x86_64-13.0.85-archive.tar.xz",
"sha256": "98fca11f9ab89be61385a67eee686c1ebf76fad9c7269d0cf9090edfcdb8a8ac",
"md5": "4b61b30864c47e1292f6d132653140d1",
"size": "21412"
},
{
"component": "libnvvm",
"version": "13.0.88",
"relative_path": "libnvvm/linux-x86_64/libnvvm-linux-x86_64-13.0.88-archive.tar.xz",
"sha256": "17ef1665b63670887eeba7d908da5669fa8c66bb73b5b4c1367f49929c086353",
"md5": "816927093ffbdc10fddd751f045396b1",
"size": "43645408"
},
{
"component": "libcublas",
"version": "13.0.2.14",
"relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.0.2.14-archive.tar.xz",
"sha256": "158c1d7e862282d5218ed82f173ba14679c0f8afa1fe8cb4a3a34a4c0a9a5ff9",
"md5": "f17607125167fbb269fdb40b6991b543",
"size": "800056524"
}
]
}
+46
View File
@@ -791,3 +791,49 @@ not-ready response, and graceful shutdown in an isolated non-root read-only
container. CLI prereleases require this check as well as the static binary job.
This is a CLI-only image: full CUDA OCI deployment, model startup and GPU
readiness remain separate acceptance gates. No image is pushed to a registry.
## Isolated hosted CUDA packaging (STRA-69)
`workflow_dispatch` input `hosted_cuda_package=true` selects a private-repository
Ubuntu 24.04 CPU job. It never targets the private GPU runner. The existing
`static_cuda_package` and `keyless_gpu` inputs remain false unless explicitly
selected. This build does not load a model or install a driver.
The build-only `scripts/bootstrap-cuda-toolkit.py` assembles seven components
from NVIDIA's [CUDA 13.0.1 redistrib manifest](https://developer.download.nvidia.com/compute/cuda/redist/redistrib_13.0.1.json),
using its committed manifest/component SHA256 and size pins in
`deploy/cuda-toolkit.lock.json`. Download size is 872,943,748 bytes. A fresh private
prefix, bounded downloads/expansion, safe tar extraction, collision/link checks
and retained component licenses avoid a system CUDA installation. This is a
build dependency bootstrap, not an end-user runtime installer. NVIDIA documents
[component assembly and supported host compilers](https://docs.nvidia.com/cuda/archive/13.0.1/cuda-installation-guide-linux/index.html).
The job explicitly uses GCC 13, one engine compile job, two Rust build jobs and a
150-minute job limit; it refuses acquisition below 6 GiB RAM or 12 GiB free disk.
Actual host/compiler versions and initial resources are recorded. Toolkit bytes
are pinned; hosted OS/compiler patch updates mean byte-identical rebuilds are
not asserted.
Nonempty Linux engine payloads use a target-assembler `.incbin` in a read-only
ELF section after the existing bounded SHA/ELF verification. Rust references
that immutable section through an exact-length external static; it does not
parse a 600+ MB engine as a Rust byte-array constant. Empty/nonembedded builds
remain unchanged. The hosted packaging step records memory/disk counters and
`time -v` resource usage. Two initial hosted attempts received runner shutdown
signals during the previous Rust embedding path; those logs do not establish
an OOM diagnosis. Exact memfd bytes, seals, restart and external-worker output
equality remain mandatory checks for this build-path change.
Existing static-engine, combined-package and OCI builders supply the actual
compile/link, dependency/ABI, embedded identity and GPU-hidden help gates.
The private `strata-next-hosted-cuda-preview` artifact retains package checksums,
source provenance, image archive/receipt, exact toolkit manifest/toolchain data
and component license archive. Retention is seven days. Successful upload is
required; an ephemeral hosted runner is not durable fallback storage if upload
fails. Owned build directories and image are cleaned. Tests use deliberately
invalid archives/receipts and do not require CUDA; only a successful manual
actual-CUDA job qualifies compilation and packaging. GPU driver loading,
full-model/MTP inference, quality and clean-node rollback remain separate gates.
```sh
gh workflow run linux.yml --ref COMMITTED_REF -f hosted_cuda_package=true
```
+143
View File
@@ -0,0 +1,143 @@
#!/usr/bin/env python3
"""Build-only pinned CUDA component bootstrap for an isolated Linux CPU runner.
No driver installation, model access, root privileges or inference. NVIDIA's
redistrib archives are assembly inputs, not a general-purpose CUDA installer.
"""
import argparse
import hashlib
import json
import os
from pathlib import Path, PurePosixPath
import platform
import shutil
import tarfile
import tempfile
import time
import urllib.request
BASE = 'https://developer.download.nvidia.com/compute/cuda/redist/'
COMPONENTS = {'cuda_nvcc','cuda_crt','cuda_cudart','cuda_cccl','cuda_culibos','libnvvm','libcublas'}
def download(url, dest, expected, limit, exact=None):
digest=hashlib.sha256();total=0;deadline=time.monotonic()+600
with urllib.request.urlopen(url, timeout=30) as response, dest.open('xb') as out:
if not response.url.startswith(BASE):
raise ValueError('archive redirect left the official redistrib origin')
while block:=response.read(1024*1024):
total+=len(block)
if total>limit or time.monotonic()>deadline:
raise ValueError('download size/time limit exceeded')
digest.update(block);out.write(block)
if digest.hexdigest()!=expected or (exact is not None and total!=exact):
raise ValueError('NVIDIA component checksum/size mismatch')
def validate_lock(lock, manifest):
if lock['release']!='13.0.1' or lock['manifest_url']!=BASE+'redistrib_13.0.1.json':
raise ValueError('unsupported toolkit release')
if len(lock['components'])!=len(COMPONENTS) or {x['component'] for x in lock['components']}!=COMPONENTS:
raise ValueError('unexpected CUDA component set')
for item in lock['components']:
reference=manifest[item['component']]
if item['version']!=reference['version']:
raise ValueError('component version mismatch')
for key in ('relative_path','sha256','size'):
if item[key]!=reference['linux-x86_64'][key]:
raise ValueError('component differs from pinned official manifest')
path=PurePosixPath(item['relative_path'])
if path.is_absolute() or '..' in path.parts or not str(path).endswith('.tar.xz'):
raise ValueError('invalid component path')
if not 0<int(item['size'])<1024**3:
raise ValueError('component exceeds download budget')
def extract(archive, destination, root_name):
with tarfile.open(archive, 'r:xz') as source:
members=source.getmembers()
if len(members)>50000 or sum(x.size for x in members)>6*1024**3:
raise ValueError('archive expansion limit exceeded')
seen=set()
for item in members:
path=PurePosixPath(item.name)
if path.is_absolute() or '..' in path.parts or not path.parts or path.parts[0]!=root_name:
raise ValueError('archive path outside component root')
if item.name in seen:
raise ValueError('duplicate archive member')
seen.add(item.name)
if not (item.isdir() or item.isfile() or item.issym() or item.islnk()):
raise ValueError('unsupported archive member')
source.extractall(destination, members=members, filter='data')
return destination/root_name
def merge(source, dest):
# Only verified, safely extracted component trees are accepted here.
if source.is_dir() and not source.is_symlink():
if dest.is_symlink() or (dest.exists() and not dest.is_dir()):
raise ValueError('toolkit directory collision')
dest.mkdir(mode=0o700, exist_ok=True)
for child in source.iterdir():merge(child,dest/child.name)
elif os.path.lexists(dest):
if source.is_symlink() and dest.is_symlink() and os.readlink(source)==os.readlink(dest):
return
if source.is_file() and dest.is_file() and not source.is_symlink() and not dest.is_symlink():
with source.open('rb') as a,dest.open('rb') as b:
if hashlib.file_digest(a,'sha256').digest()==hashlib.file_digest(b,'sha256').digest():return
raise ValueError('conflicting CUDA component files')
else:
source.rename(dest)
def resource_gate(parent):
memory=int(next(x.split()[1] for x in Path('/proc/meminfo').read_text().splitlines() if x.startswith('MemTotal:')))*1024
free=shutil.disk_usage(parent).free
if memory<6*1024**3 or free<12*1024**3:
raise ValueError('hosted CUDA build requires at least 6GiB RAM and 12GiB free disk')
return {'memory_bytes':memory,'free_disk_bytes':free,'compile_jobs':1,'gpu_used':False}
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--lock',type=Path,default=Path(__file__).resolve().parents[1]/'deploy/cuda-toolkit.lock.json')
parser.add_argument('--output',required=True,type=Path)
args=parser.parse_args()
if platform.system()!='Linux' or platform.machine()!='x86_64':
raise ValueError('bootstrap requires Linux x86_64')
os.umask(0o077)
output=args.output.absolute()
if os.path.lexists(output):raise ValueError('toolkit output already exists; use a fresh private directory')
resources=resource_gate(output.parent)
lock=json.loads(args.lock.read_text())
with tempfile.TemporaryDirectory(prefix='.cuda-stage-',dir=output.parent) as temp:
stage=Path(temp);prefix=stage/'toolkit';prefix.mkdir(mode=0o700)
manifest=stage/'manifest.json'
if lock['manifest_url']!=BASE+'redistrib_13.0.1.json':raise ValueError('unsupported manifest URL')
download(lock['manifest_url'],manifest,lock['manifest_sha256'],1024**2)
validate_lock(lock,json.loads(manifest.read_text()))
for item in lock['components']:
archive=stage/(item['component']+'.tar.xz')
download(BASE+item['relative_path'],archive,item['sha256'],int(item['size']),int(item['size']))
extracted=extract(archive,stage,Path(item['relative_path']).name.removesuffix('.tar.xz'))
for child in extracted.iterdir():
if child.is_dir() and not child.is_symlink():merge(child,prefix/child.name)
else:
licenses=prefix/'licenses'/item['component'];licenses.mkdir(parents=True,exist_ok=True)
merge(child,licenses/child.name)
shutil.rmtree(extracted);archive.unlink()
# NVCC's 64-bit link search uses lib64; redistrib archives use lib.
(prefix/'lib64').symlink_to('lib',target_is_directory=True)
for path in prefix.rglob('*'):
if path.is_symlink() and (not path.resolve().is_relative_to(prefix) or not path.exists()):
raise ValueError('assembled toolkit has an invalid symlink')
for name in ('bin/nvcc','nvvm/bin/cicc','include/cuda_runtime.h','lib/libcudart_static.a',
'lib/libcublas_static.a','lib/libcublasLt_static.a','lib/libculibos.a'):
if not (prefix/name).is_file():raise ValueError('assembled toolkit missing '+name)
(prefix/'TOOLKIT-PROVENANCE.json').write_text(json.dumps({'lock':lock,'resources':resources},indent=2)+'\n')
if os.path.lexists(output):raise ValueError('toolkit destination appeared during bootstrap')
prefix.rename(output)
print(json.dumps({'toolkit':str(output),'release':lock['release'],**resources}))
if __name__=='__main__':main()
+1
View File
@@ -9,6 +9,7 @@ python3 "${repo_root}/scripts/test-native-service.py"
python3 "${repo_root}/scripts/test-native-api.py"
python3 "${repo_root}/scripts/test-native-menu.py"
python3 "${repo_root}/scripts/test-model-switch.py"
python3 "${repo_root}/scripts/test-cuda-bootstrap.py"
python3 "${repo_root}/scripts/test-static-cuda-elf.py"
python3 "${repo_root}/scripts/test-linux-package.py"
python3 "${repo_root}/scripts/test-runtime-image.py"
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env python3
import importlib.util
import io
import json
from pathlib import Path
import tarfile
import tempfile
import unittest
from unittest.mock import patch
spec=importlib.util.spec_from_file_location('bootstrap',Path(__file__).with_name('bootstrap-cuda-toolkit.py'))
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
class Tests(unittest.TestCase):
def test_safe_tree_and_internal_link(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);archive=root/'test.tar.xz'
with tarfile.open(archive,'w:xz') as t:
item=tarfile.TarInfo('component/lib/a');item.size=1;t.addfile(item,io.BytesIO(b'a'))
item=tarfile.TarInfo('component/lib/b');item.type=tarfile.SYMTYPE;item.linkname='a';t.addfile(item)
out=m.extract(archive,root/'out','component')
self.assertEqual((out/'lib/b').read_bytes(),b'a')
def test_bad_archive_paths_and_links(self):
for name,link in [('../escape',None),('/escape',None),('other/file',None),('component/b','../../escape')]:
with self.subTest(name=name),tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);archive=root/'test.tar.xz'
with tarfile.open(archive,'w:xz') as t:
item=tarfile.TarInfo(name)
if link:item.type=tarfile.SYMTYPE;item.linkname=link
t.addfile(item)
with self.assertRaises((ValueError,tarfile.TarError)):m.extract(archive,root/'out','component')
self.assertFalse((root/'escape').exists())
def test_component_merge_rejects_conflict(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);a=root/'a';b=root/'b';a.mkdir();b.mkdir()
(a/'x').write_text('a');(b/'x').write_text('b')
with self.assertRaises(ValueError):m.merge(a,b)
self.assertEqual((b/'x').read_text(),'b')
def test_identical_merge_and_moving(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);a=root/'a';b=root/'b';a.mkdir();b.mkdir()
(a/'x').write_text('a');(b/'x').write_text('a');(a/'y').write_text('y')
m.merge(a,b);self.assertEqual((b/'y').read_text(),'y');self.assertFalse((a/'y').exists())
def test_download_mismatch_size_and_redirect(self):
for data,url,sha,limit in [(b'bad',m.BASE+'x','0'*64,4),(b'large',m.BASE+'x','0'*64,2),(b'x','https://other.invalid/x','0'*64,2)]:
with tempfile.TemporaryDirectory() as tmp:
response=io.BytesIO(data);response.url=url
with patch.object(m.urllib.request,'urlopen',return_value=response),self.assertRaises(ValueError):
m.download(m.BASE+'x',Path(tmp)/'file',sha,limit)
def test_lock_pins_match_reference(self):
lock=json.loads((Path(__file__).resolve().parents[1]/'deploy/cuda-toolkit.lock.json').read_text())
manifest={x['component']:{'version':x['version'],'linux-x86_64':x.copy()} for x in lock['components']}
m.validate_lock(lock,manifest)
lock['components'][0]['sha256']='0'*64
with self.assertRaises(ValueError):m.validate_lock(lock,manifest)
def test_resource_gate_before_download(self):
with patch.object(m.Path,'read_text',return_value='MemTotal: 1024 kB\n'),self.assertRaises(ValueError):m.resource_gate(Path('/tmp'))
if __name__=='__main__':unittest.main()