fix(deploy): repair CLI container build and test actual OCI startup
This commit is contained in:
+4
-1
@@ -4,6 +4,9 @@ models/
|
||||
captures/
|
||||
logs/
|
||||
control-plane/target/
|
||||
engine/
|
||||
engine/*
|
||||
!engine/strata/
|
||||
engine/strata/*
|
||||
!engine/strata/LICENSE
|
||||
benchmarks/
|
||||
docs/
|
||||
|
||||
@@ -167,9 +167,22 @@ jobs:
|
||||
name: strata-next-linux-x86_64-musl
|
||||
path: dist/
|
||||
|
||||
linux-cli-container:
|
||||
needs: verify
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build actual CLI-only scratch image
|
||||
run: docker build --file deploy/Dockerfile.static-cli --tag strata-cli-check .
|
||||
- name: Check isolated CLI container startup and shutdown
|
||||
run: python3 scripts/smoke-cli-container.py strata-cli-check
|
||||
- name: Remove test image
|
||||
if: always()
|
||||
run: docker image rm strata-cli-check || true
|
||||
|
||||
release-cli:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: linux-static-cli
|
||||
needs: [linux-static-cli, linux-cli-container]
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -10,6 +10,7 @@ WORKDIR /src
|
||||
COPY rust-toolchain.toml ./
|
||||
COPY manifests/ ./manifests/
|
||||
COPY control-plane/ ./control-plane/
|
||||
COPY engine/strata/LICENSE ./engine/strata/LICENSE
|
||||
RUN cargo build --manifest-path control-plane/Cargo.toml --locked --release \
|
||||
--target "${RUST_TARGET}" --bin strata-next
|
||||
|
||||
|
||||
@@ -771,3 +771,23 @@ soak still remain; hosted Actions has not run.
|
||||
removed after retaining the private candidate, link command, CMake cache and
|
||||
build/test logs. No original toolkit archives, baseline binaries or model
|
||||
files were removed.
|
||||
# Static CLI OCI acceptance (STRA-66)
|
||||
|
||||
`deploy/Dockerfile.static-cli` builds the Rust CLI/control plane into `scratch`.
|
||||
Its build context includes the upstream license used by `--engine-license`;
|
||||
the other engine files remain excluded. Build and verify it with:
|
||||
|
||||
```sh
|
||||
docker build -f deploy/Dockerfile.static-cli -t strata-cli-check .
|
||||
python3 scripts/smoke-cli-container.py strata-cli-check
|
||||
docker image rm strata-cli-check
|
||||
```
|
||||
|
||||
On an arm64 Linux Docker host, pass
|
||||
`--build-arg RUST_TARGET=aarch64-unknown-linux-musl` to the build. The hosted
|
||||
`linux-cli-container` job builds the actual x86_64 image and checks the exact
|
||||
upstream license, CLI version, missing embedded engine/model, HTTP health,
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Exercise the actual CLI-only scratch image; never starts an inference worker."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import uuid
|
||||
|
||||
|
||||
def docker(*args, check=True):
|
||||
return subprocess.run(['docker', *args], check=check, capture_output=True,
|
||||
text=True, timeout=30)
|
||||
|
||||
|
||||
def main(image):
|
||||
name = 'strata-cli-smoke-' + uuid.uuid4().hex
|
||||
common = ['--name', name, '--read-only', '--user', '65532:65532',
|
||||
'--cap-drop', 'ALL', '--security-opt', 'no-new-privileges']
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
|
||||
def get(port, route):
|
||||
try:
|
||||
with opener.open(f'http://127.0.0.1:{port}{route}', timeout=2) as response:
|
||||
return response.status, json.load(response)
|
||||
except urllib.error.HTTPError as error:
|
||||
return error.code, json.load(error)
|
||||
|
||||
try:
|
||||
version = docker('run', '--rm', *common, '--network', 'none', image, '--version').stdout
|
||||
assert version.startswith('strata-next '), version
|
||||
license_text = docker('run', '--rm', *common, '--network', 'none', image,
|
||||
'--engine-license').stdout
|
||||
assert license_text == (root / 'engine/strata/LICENSE').read_text()
|
||||
info = json.loads(docker('run', '--rm', *common, '--network', 'none', image,
|
||||
'engine-info').stdout)
|
||||
assert info['embedded'] is False and info['model_bundled'] is False, info
|
||||
docker('run', '-d', *common, '-p', '127.0.0.1::8081',
|
||||
'-e', 'STRATA_BIND=0.0.0.0:8081', image, 'serve')
|
||||
binding = docker('port', name, '8081/tcp').stdout.strip()
|
||||
assert binding.startswith('127.0.0.1:'), binding
|
||||
port = int(binding.rsplit(':', 1)[1])
|
||||
deadline = time.monotonic() + 15
|
||||
while True:
|
||||
try:
|
||||
assert get(port, '/health') == (200, {'status': 'ok'})
|
||||
break
|
||||
except (OSError, AssertionError):
|
||||
if time.monotonic() >= deadline:
|
||||
raise
|
||||
time.sleep(0.1)
|
||||
status, ready = get(port, '/ready')
|
||||
assert status == 503 and ready['ready'] is False, (status, ready)
|
||||
docker('stop', '--time', '10', name)
|
||||
state = json.loads(docker('inspect', '--format', '{{json .State}}', name).stdout)
|
||||
assert state['ExitCode'] == 0 and not state['OOMKilled'], state
|
||||
print('CLI OCI passed: actual image, exact upstream license, no embedded engine/model, '
|
||||
'non-root read-only health200/ready503, graceful stop. No GPU inference qualified.')
|
||||
finally:
|
||||
docker('rm', '-f', name, check=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1])
|
||||
Reference in New Issue
Block a user