fix(podman): bound setup image builds · openclaw/openclaw@d6fcb56
vincentkoc
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,6 +29,7 @@ PLATFORM_NAME="$(uname -s 2>/dev/null || echo unknown)"
|
29 | 29 | HOST_GATEWAY_PORT="${OPENCLAW_PODMAN_GATEWAY_HOST_PORT:-${OPENCLAW_GATEWAY_PORT:-18789}}" |
30 | 30 | QUADLET_GATEWAY_PORT="18789" |
31 | 31 | PODMAN_PULL_TIMEOUT="${OPENCLAW_PODMAN_SETUP_PULL_TIMEOUT:-600s}" |
| 32 | +PODMAN_BUILD_TIMEOUT="${OPENCLAW_PODMAN_SETUP_BUILD_TIMEOUT:-1800s}" |
32 | 33 | |
33 | 34 | require_cmd() { |
34 | 35 | if ! command -v "$1" >/dev/null 2>&1; then |
@@ -57,6 +58,18 @@ run_podman_pull() {
|
57 | 58 | podman pull "$image" |
58 | 59 | } |
59 | 60 | |
| 61 | +run_podman_build() { |
| 62 | +if command -v timeout >/dev/null 2>&1; then |
| 63 | +if timeout --kill-after=1s 1s true >/dev/null 2>&1; then |
| 64 | + timeout --kill-after=30s "$PODMAN_BUILD_TIMEOUT" podman build "$@" |
| 65 | +else |
| 66 | + timeout "$PODMAN_BUILD_TIMEOUT" podman build "$@" |
| 67 | +fi |
| 68 | +return |
| 69 | +fi |
| 70 | + podman build "$@" |
| 71 | +} |
| 72 | + |
60 | 73 | validate_single_line_value() { |
61 | 74 | local label="$1" |
62 | 75 | local value="$2" |
|
390 | 403 | |
391 | 404 | if [[ "$OPENCLAW_IMAGE" == "openclaw:local" ]]; then |
392 | 405 | echo "Building image $OPENCLAW_IMAGE ..." |
393 | | -podman build -t "$OPENCLAW_IMAGE" -f "$REPO_PATH/Dockerfile" "${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}" "$REPO_PATH" |
| 406 | +run_podman_build -t "$OPENCLAW_IMAGE" -f "$REPO_PATH/Dockerfile" "${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}" "$REPO_PATH" |
394 | 407 | else |
395 | 408 | if podman image exists "$OPENCLAW_IMAGE" >/dev/null 2>&1; then |
396 | 409 | echo "Using existing image $OPENCLAW_IMAGE" |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -147,6 +147,20 @@ describe("test-install-sh-docker", () => {
|
147 | 147 | expect(script).not.toContain('podman pull "$OPENCLAW_IMAGE"'); |
148 | 148 | }); |
149 | 149 | |
| 150 | +it("bounds Podman setup image builds", () => { |
| 151 | +const script = readFileSync(PODMAN_SETUP_PATH, "utf8"); |
| 152 | + |
| 153 | +expect(script).toContain( |
| 154 | +'PODMAN_BUILD_TIMEOUT="${OPENCLAW_PODMAN_SETUP_BUILD_TIMEOUT:-1800s}"', |
| 155 | +); |
| 156 | +expect(script).toContain("run_podman_build()"); |
| 157 | +expect(script).toContain("timeout --kill-after=1s 1s true"); |
| 158 | +expect(script).toContain('timeout --kill-after=30s "$PODMAN_BUILD_TIMEOUT" podman build "$@"'); |
| 159 | +expect(script).toContain('timeout "$PODMAN_BUILD_TIMEOUT" podman build "$@"'); |
| 160 | +expect(script).toContain('run_podman_build -t "$OPENCLAW_IMAGE"'); |
| 161 | +expect(script).not.toContain('podman build -t "$OPENCLAW_IMAGE"'); |
| 162 | +}); |
| 163 | + |
150 | 164 | it("bounds detached Podman launches without timing out onboarding", () => { |
151 | 165 | const script = readFileSync(PODMAN_RUN_PATH, "utf8"); |
152 | 166 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。