openclaw/scripts/e2e/plugin-lifecycle-matrix-docker.sh
Peter Steinberger 9ed5a04a65
ci: warn on size and performance limits in GitHub Actions
Source and performance budgets shared fatal exits with correctness checks,
so ordinary growth could block otherwise valid changes. Centralize limit
severity and GitHub annotations/summaries, keep local checks strict, and
carry warnings across native lint, container, and BuildKit boundaries.

Keep semantic lint, types, API inventories, source ownership, invalid
measurements, process failures, and runner admission guards blocking.

Validation: P2 review clean; three Linux owner-configuration replays and
20 standalone policy runs passed; typechecks, targeted type-aware lint,
Knip export scans, workflow checks, formatting, and diff checks passed.
The changed gate found a test environment typing error, corrected and
verified by the root-test typecheck. One unrelated preparation process
cleanup failure did not reproduce in its diagnostic replay; no fix claimed.
2026-09-23 02:35:32 -07:00

84 lines
2.9 KiB
Bash
Executable file

#!/usr/bin/env bash
# Bash 5.3+ can deadlock writing heredoc pipes on macOS before the reader starts.
if [[ ${OSTYPE:-} == darwin* && $BASH != /bin/bash ]] && ((BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 3))); then
exec /bin/bash "$0" "$@"
fi
# Bare package-level plugin lifecycle matrix with resource metrics.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
source "$ROOT_DIR/scripts/lib/docker-e2e-package.sh"
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-plugin-lifecycle-matrix-e2e" OPENCLAW_PLUGIN_LIFECYCLE_MATRIX_E2E_IMAGE)"
SKIP_BUILD="${OPENCLAW_PLUGIN_LIFECYCLE_MATRIX_E2E_SKIP_BUILD:-0}"
LIMITS_SUMMARY=""
cleanup() {
if [[ -n "$LIMITS_SUMMARY" ]]; then
if [[ -n "${GITHUB_STEP_SUMMARY:-}" && -s "$LIMITS_SUMMARY" ]]; then
cat "$LIMITS_SUMMARY" >> "$GITHUB_STEP_SUMMARY"
fi
rm -f "$LIMITS_SUMMARY"
fi
docker_e2e_cleanup_package_tgz "${PACKAGE_TGZ:-}"
}
trap cleanup EXIT
DOCKER_ENV_ARGS=(
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0
-e OPENCLAW_SKIP_CHANNELS=1
-e OPENCLAW_SKIP_PROVIDERS=1
)
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
LIMITS_SUMMARY="$(mktemp "${TMPDIR:-/tmp}/openclaw-plugin-lifecycle-limits.XXXXXX")"
chmod 666 "$LIMITS_SUMMARY"
DOCKER_ENV_ARGS+=(
-e GITHUB_ACTIONS
-e GITHUB_STEP_SUMMARY=/tmp/openclaw-limits-summary.md
-v "$LIMITS_SUMMARY:/tmp/openclaw-limits-summary.md"
)
fi
append_positive_int_env() {
local name="$1"
local value="${!name-}"
if [ -z "$value" ]; then
return 0
fi
value="$(docker_e2e_normalize_positive_int_value "$name" "$value")" || return $?
DOCKER_ENV_ARGS+=(-e "$name=$value")
}
append_positive_number_env() {
local name="$1"
local value="${!name-}"
if [ -z "$value" ]; then
return 0
fi
if [[ ! "$value" =~ ^[0-9]+([.][0-9]+)?$ ]] || [[ -z "${value//[0.]/}" ]]; then
echo "invalid $name: $value" >&2
return 2
fi
DOCKER_ENV_ARGS+=(-e "$name=$value")
}
append_positive_int_env OPENCLAW_PLUGIN_LIFECYCLE_PHASE_TIMEOUT_MS
append_positive_int_env OPENCLAW_PLUGIN_LIFECYCLE_TIMEOUT_KILL_GRACE_MS
append_positive_int_env OPENCLAW_PLUGIN_LIFECYCLE_METRIC_POLL_MS
append_positive_int_env OPENCLAW_PLUGIN_LIFECYCLE_MAX_RSS_KB
append_positive_int_env OPENCLAW_PLUGIN_LIFECYCLE_MAX_WALL_MS
append_positive_number_env OPENCLAW_PLUGIN_LIFECYCLE_MAX_CPU_CORE_RATIO
PACKAGE_TGZ="$(docker_e2e_prepare_package_tgz plugin-lifecycle-matrix "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}")"
docker_e2e_package_mount_args "$PACKAGE_TGZ"
docker_e2e_build_or_reuse "$IMAGE_NAME" plugin-lifecycle-matrix "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" "bare" "$SKIP_BUILD"
echo "Running plugin lifecycle matrix Docker E2E..."
docker_e2e_run_with_harness \
"${DOCKER_ENV_ARGS[@]}" \
"${DOCKER_E2E_PACKAGE_ARGS[@]}" \
"$IMAGE_NAME" \
tsx test/e2e/qa-lab/plugins/plugin-lifecycle-probe-runtime.ts --lifecycle-matrix
echo "Plugin lifecycle matrix Docker E2E passed."