mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +00:00
* docs(quickstart): fix raw URL for corporate-proxy fallback (H1) * feat(docker)!: drop :full image variant — use sibling containers on ccs-net (Q3) No AI CLIs (claude-code/gemini-cli/grok-cli/opencode) are bundled in the image. Use sibling containers attached to ccs-net instead. See docker/README.md#connect-your-app-to-cliproxy. Also removes bash from apk deps (entrypoint uses #!/bin/sh — L2). ci(docker): publish only immutable :<ver> tag pre-smoke; promote-mutable-tags job adds :latest/:MAJOR/:MINOR aliases only after smoke tests pass (H3) ci(docker): smoke-test-compose-url runs network-contract.sh against the downloaded /tmp/ccs-compose.yaml instead of re-cloning the repo (H4) ci(docker): sign published images with cosign keyless OIDC + attach provenance/SBOM via build-push-action (M8) test(docker): network-contract.sh now accepts compose-file and image-ref positional args; replaces python3 healthcheck parser with jq (L4) * chore(release): cut every main release as rc.N prerelease, manual promote flow (H2) - .releaserc.cjs: main branch now uses prerelease 'rc' channel — every semantic-release cut becomes vX.Y.Z-rc.N - add promote-release.yml: workflow_dispatch flips rc → stable via 'gh release edit --prerelease=false'; triggers docker promote-mutable-tags - add docs/release-process.md: full soak + promote procedure, rollback steps, cosign verification command - releaseNotesGenerator: add revert section, document chore hidden behaviour (L8) * fix(docker): healthcheck probes both dashboard and cliproxy ports (M1) compose.yaml healthcheck now checks :3000 and :8317 concurrently with a 4.5s internal timeout, within Docker's 5s timeout budget. Also: - docs(docker): document npm lockfile ephemeral tradeoff above install layer; note size-budget regression test as the practical safeguard (M3) - docs(docker): drop :full row from Choosing an image table; add sibling container note pointing to connect-your-app-to-cliproxy (Q3/docs) - docs(docker): remove :full docker run block; fix release-tag sentence (Q3) - docs(docker): fix raw URL in migration section (H1 parity) - docs(docker): add Volume warning — 'down -v' deletes named volumes (L13) - docs(docker): update What changes table — remove :full reference (Q3) - docs(docker): add Image Signatures and SBOM section with cosign verify and sbom download commands (M8/docs) - changelog: add Unreleased entries for rc soak, cosign signing, :full removal with migration guidance * ci(docker): assert image-size budget per platform; add compose parity + breaking-change guard (M6/L9/L12) - image-size.sh: add --platform flag; uses 'docker buildx imagetools inspect' to sum compressed layer sizes from registry manifest for linux/amd64 and linux/arm64 separately (M6) - docker-release.yml smoke-test: runs size check for both platforms - compose-parity.sh: diffs docker/compose.yaml vs docker/docker-compose.integrated.yml for image name, ports 3000/8317, volume mounts /root/.ccs and /var/log/ccs, ccs-net definition (L12) - ci.yml: add compose-parity job wired to cliproxy runner (L12) - breaking-change-guard.yml: fails PR if compose.yaml changes image name, network name, or container_name without a feat!/fix! commit (L9) * chore(ci): fix cosign shell substitution — use tr instead of bash @L expansion (L6/nit) * test(docker): fix compose-parity port regex for variable-interpolated host ports
106 lines
3.7 KiB
Bash
Executable File
106 lines
3.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# tests/docker/network-contract.sh
|
|
#
|
|
# Verifies the stable ccs-net Docker network contract:
|
|
# - Network name: ccs-net
|
|
# - Service DNS: ccs
|
|
# - CLIProxy: http://ccs:8317
|
|
# - Dashboard: http://ccs:3000
|
|
#
|
|
# Requires: Docker with compose plugin, internet access to pull curlimages/curl
|
|
# Usage: bash tests/docker/network-contract.sh [compose-file] [image-ref]
|
|
# compose-file Path to compose file (default: docker/compose.yaml)
|
|
# image-ref Override the image used in the compose file (optional).
|
|
# When set, the compose stack is run with that image instead
|
|
# of whatever is pinned in the compose file.
|
|
# Called from repo root so the default path resolves.
|
|
#
|
|
set -euo pipefail
|
|
|
|
COMPOSE_FILE="${1:-docker/compose.yaml}"
|
|
IMAGE_OVERRIDE="${2:-}"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Helpers
|
|
# ---------------------------------------------------------------------------
|
|
log() { printf '[i] %s\n' "$*"; }
|
|
ok() { printf '[OK] %s\n' "$*"; }
|
|
err() { printf '[X] %s\n' "$*" >&2; }
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Bring stack up; register teardown on any exit
|
|
# ---------------------------------------------------------------------------
|
|
log "Bringing CCS stack up: $COMPOSE_FILE"
|
|
if [[ -n "$IMAGE_OVERRIDE" ]]; then
|
|
log "Overriding image with: $IMAGE_OVERRIDE"
|
|
CCS_IMAGE="$IMAGE_OVERRIDE" docker compose -f "$COMPOSE_FILE" up -d
|
|
else
|
|
docker compose -f "$COMPOSE_FILE" up -d
|
|
fi
|
|
|
|
cleanup() {
|
|
log "Tearing down stack..."
|
|
docker compose -f "$COMPOSE_FILE" down -v 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Wait for healthcheck (max 90s) — use jq instead of python3 for CI portability
|
|
# ---------------------------------------------------------------------------
|
|
log "Waiting for healthcheck to pass (max 90s)..."
|
|
WAIT_MAX=45 # 45 x 2s = 90s
|
|
HEALTHY=0
|
|
for _i in $(seq 1 "$WAIT_MAX"); do
|
|
STATUS=$(
|
|
docker compose -f "$COMPOSE_FILE" ps --format json 2>/dev/null \
|
|
| jq -r 'if type == "array" then .[] else . end | select(.Service != null and (.Service | contains("ccs"))) | .Health // "unknown"' \
|
|
2>/dev/null | head -1 || echo "unknown"
|
|
)
|
|
STATUS="${STATUS:-unknown}"
|
|
if [ "$STATUS" = "healthy" ]; then
|
|
HEALTHY=1
|
|
break
|
|
fi
|
|
log "Health: $STATUS (attempt ${_i}/${WAIT_MAX})"
|
|
sleep 2
|
|
done
|
|
|
|
if [ "$HEALTHY" -ne 1 ]; then
|
|
err "Container did not become healthy within 90s"
|
|
exit 1
|
|
fi
|
|
ok "Container is healthy"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Verify ccs-net network exists on the host
|
|
# ---------------------------------------------------------------------------
|
|
log "Inspecting ccs-net network..."
|
|
docker network inspect ccs-net >/dev/null
|
|
ok "ccs-net network exists"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Verify DNS resolution from a sibling container on ccs-net
|
|
# ---------------------------------------------------------------------------
|
|
log "Testing http://ccs:8317 from sibling container..."
|
|
docker run --rm \
|
|
--network ccs-net \
|
|
curlimages/curl:latest \
|
|
-fsS --max-time 10 \
|
|
http://ccs:8317/ \
|
|
>/dev/null
|
|
ok "CLIProxy reachable at http://ccs:8317"
|
|
|
|
log "Testing http://ccs:3000 from sibling container..."
|
|
docker run --rm \
|
|
--network ccs-net \
|
|
curlimages/curl:latest \
|
|
-fsS --max-time 10 \
|
|
http://ccs:3000/ \
|
|
>/dev/null
|
|
ok "Dashboard reachable at http://ccs:3000"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Done
|
|
# ---------------------------------------------------------------------------
|
|
ok "network contract verified"
|