Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7d24c7401 | ||
|
|
fb3ce6e8c5 | ||
|
|
63a56772da | ||
|
|
b848e433a3 | ||
|
|
3aea854d41 |
@@ -1,20 +1,29 @@
|
||||
name: Desktop foundation
|
||||
on:
|
||||
push:
|
||||
paths: ['desktop-core/**', 'desktop/**', '.github/workflows/desktop.yml', 'rust-toolchain.toml']
|
||||
# Main pushes exclude CLI release tags; feature branches use pull requests.
|
||||
branches: [main]
|
||||
paths: ['desktop-core/**', 'desktop/**', '.github/workflows/desktop.yml', 'rust-toolchain.toml', 'scripts/install-pinned-rustup.sh', 'Cargo.toml', 'Cargo.lock']
|
||||
pull_request:
|
||||
paths: ['desktop-core/**', 'desktop/**', '.github/workflows/desktop.yml', 'rust-toolchain.toml']
|
||||
paths: ['desktop-core/**', 'desktop/**', '.github/workflows/desktop.yml', 'rust-toolchain.toml', 'scripts/install-pinned-rustup.sh', 'Cargo.toml', 'Cargo.lock']
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
core:
|
||||
env:
|
||||
CARGO_TARGET_DIR: ${{ github.workspace }}/desktop-core/target
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
# Windows/macOS validation is deferred and unqualified.
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Linux build tools
|
||||
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates build-essential python3 python-is-python3
|
||||
- name: Install pinned Rust
|
||||
run: scripts/install-pinned-rustup.sh rustup toolchain install 1.99.0 --profile minimal --component rustfmt --component clippy
|
||||
- name: Format
|
||||
run: cargo fmt --manifest-path desktop-core/Cargo.toml --check
|
||||
- name: Tests
|
||||
|
||||
@@ -481,12 +481,41 @@ jobs:
|
||||
command -v docker >/dev/null 2>&1 || { apt-get update -qq; DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker.io; }
|
||||
docker version
|
||||
- name: Build actual CLI-only scratch image
|
||||
run: docker build --file deploy/Dockerfile.static-cli --tag strata-cli-check .
|
||||
run: |
|
||||
set -euo pipefail
|
||||
owned_dir="$(mktemp -d "$RUNNER_TEMP/leleka-cli-check-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-XXXXXX")"
|
||||
image_tag="leleka-cli-check:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${owned_dir##*-}"
|
||||
printf '%s\n' "CLI_CHECK_DIR=$owned_dir" "CLI_CHECK_TAG=$image_tag" >> "$GITHUB_ENV"
|
||||
# The nonce label makes identical builds distinct image configs on the shared daemon.
|
||||
docker build --file deploy/Dockerfile.static-cli --tag "$image_tag" \
|
||||
--label "io.leleka.ci.cli-check-owner=$image_tag" --iidfile "$owned_dir/image.iid" .
|
||||
image="$(cat "$owned_dir/image.iid")"
|
||||
[[ "$image" =~ ^sha256:[0-9a-f]{64}$ ]]
|
||||
test "$(docker image inspect --format '{{ index .Config.Labels "io.leleka.ci.cli-check-owner" }}' "$image")" = "$image_tag"
|
||||
- name: Check isolated CLI container startup and shutdown
|
||||
run: python3 scripts/smoke-cli-container.py strata-cli-check
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image="$(cat "$CLI_CHECK_DIR/image.iid")"
|
||||
[[ "$image" =~ ^sha256:[0-9a-f]{64}$ ]]
|
||||
test "$(docker image inspect --format '{{ index .Config.Labels "io.leleka.ci.cli-check-owner" }}' "$image")" = "$CLI_CHECK_TAG"
|
||||
python3 scripts/smoke-cli-container.py "$image"
|
||||
- name: Remove test image
|
||||
if: always()
|
||||
run: docker image rm strata-cli-check || true
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "${CLI_CHECK_DIR:-}" || exit 0
|
||||
trap 'rm -f -- "$CLI_CHECK_DIR/image.iid"; rmdir -- "$CLI_CHECK_DIR"' EXIT
|
||||
if test -s "$CLI_CHECK_DIR/image.iid"; then
|
||||
image="$(cat "$CLI_CHECK_DIR/image.iid")"
|
||||
else
|
||||
# A failed build may leave the owned tag without writing an IID receipt.
|
||||
image="$(docker image inspect --format '{{.Id}}' "$CLI_CHECK_TAG" 2>/dev/null || true)"
|
||||
fi
|
||||
test -n "$image" || exit 0
|
||||
[[ "$image" =~ ^sha256:[0-9a-f]{64}$ ]]
|
||||
test "$(docker image inspect --format '{{ index .Config.Labels "io.leleka.ci.cli-check-owner" }}' "$image")" = "$CLI_CHECK_TAG"
|
||||
# No force or parent pruning: cleanup cannot remove other jobs' references or cache.
|
||||
docker image rm --no-prune "$image"
|
||||
|
||||
release-cli:
|
||||
permissions:
|
||||
|
||||
@@ -9,12 +9,43 @@ import subprocess
|
||||
from docker_smoke_http import ISOLATION, docker, prepare_probe, request
|
||||
|
||||
|
||||
def report_best_effort(message):
|
||||
try:
|
||||
print(message, file=sys.stderr, flush=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def diagnose_owned_container(name):
|
||||
"""Emit bounded state/log diagnostics for this invocation's unique container."""
|
||||
commands = (
|
||||
('inspect', ('inspect', '--format', '{{json .State}}', name)),
|
||||
('logs', ('logs', '--tail', '40', name)),
|
||||
)
|
||||
for label, args in commands:
|
||||
try:
|
||||
result = docker(*args, check=False, timeout=8)
|
||||
output = (result.stdout or '') + (result.stderr or '')
|
||||
if len(output) > 8192:
|
||||
output = '[earlier output truncated]\n' + output[-8192:]
|
||||
if output:
|
||||
report_best_effort(
|
||||
f'Owned container {label} (exit {result.returncode}):\n{output}')
|
||||
else:
|
||||
report_best_effort(
|
||||
f'Owned container {label}: no output (exit {result.returncode})')
|
||||
except Exception as error:
|
||||
report_best_effort(
|
||||
f'Owned container {label} diagnostics unavailable: {type(error).__name__}')
|
||||
|
||||
|
||||
def main(image):
|
||||
name = 'strata-cli-smoke-' + uuid.uuid4().hex
|
||||
common = ['--name', name, *ISOLATION]
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
prepare_probe()
|
||||
|
||||
primary_error = None
|
||||
try:
|
||||
version = docker('run', '--rm', *common, '--network', 'none', image, '--version').stdout
|
||||
assert version.startswith('strata-next '), version
|
||||
@@ -24,8 +55,16 @@ def main(image):
|
||||
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, '--network', 'none',
|
||||
'-e', 'STRATA_BIND=127.0.0.1:8081', image, 'serve')
|
||||
try:
|
||||
docker('run', '-d', *common, '--network', 'none',
|
||||
'-e', 'STRATA_BIND=127.0.0.1:8081', image, 'serve', timeout=120)
|
||||
except subprocess.TimeoutExpired:
|
||||
try:
|
||||
diagnose_owned_container(name)
|
||||
except Exception as error:
|
||||
report_best_effort(
|
||||
f'Owned container diagnostics failed: {type(error).__name__}')
|
||||
raise
|
||||
deadline = time.monotonic() + 15
|
||||
while True:
|
||||
try:
|
||||
@@ -42,8 +81,25 @@ def main(image):
|
||||
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.')
|
||||
except BaseException as error:
|
||||
primary_error = error
|
||||
raise
|
||||
finally:
|
||||
docker('rm', '-f', name, check=False)
|
||||
cleanup_error = None
|
||||
try:
|
||||
result = docker('rm', '-f', name, check=False, timeout=10)
|
||||
if result.returncode:
|
||||
cleanup_error = subprocess.CalledProcessError(
|
||||
result.returncode, ['docker', 'rm', '-f', name],
|
||||
output=result.stdout, stderr=result.stderr)
|
||||
except Exception as error:
|
||||
cleanup_error = error
|
||||
if cleanup_error is not None:
|
||||
if primary_error is None:
|
||||
raise cleanup_error
|
||||
report_best_effort(
|
||||
f'Owned container cleanup failed after {type(primary_error).__name__}: '
|
||||
f'{type(cleanup_error).__name__}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user