fix(setup): kill timed image pulls when supported

This commit is contained in:
Vincent Koc
2026-05-26 16:19:33 +02:00
parent 8685dbd547
commit 35310dce8c
3 changed files with 14 additions and 2 deletions
+5 -1
View File
@@ -37,7 +37,11 @@ run_docker_build() {
run_docker_pull() {
local image="$1"
if command -v timeout >/dev/null 2>&1; then
timeout "$DOCKER_PULL_TIMEOUT" docker pull "$image"
if timeout --kill-after=1s 1s true >/dev/null 2>&1; then
timeout --kill-after=30s "$DOCKER_PULL_TIMEOUT" docker pull "$image"
else
timeout "$DOCKER_PULL_TIMEOUT" docker pull "$image"
fi
return
fi
docker pull "$image"
+5 -1
View File
@@ -47,7 +47,11 @@ fail() {
run_podman_pull() {
local image="$1"
if command -v timeout >/dev/null 2>&1; then
timeout "$PODMAN_PULL_TIMEOUT" podman pull "$image"
if timeout --kill-after=1s 1s true >/dev/null 2>&1; then
timeout --kill-after=30s "$PODMAN_PULL_TIMEOUT" podman pull "$image"
else
timeout "$PODMAN_PULL_TIMEOUT" podman pull "$image"
fi
return
fi
podman pull "$image"
@@ -126,6 +126,8 @@ describe("test-install-sh-docker", () => {
expect(script).toContain('DOCKER_PULL_TIMEOUT="${OPENCLAW_DOCKER_SETUP_PULL_TIMEOUT:-600s}"');
expect(script).toContain("run_docker_pull()");
expect(script).toContain("timeout --kill-after=1s 1s true");
expect(script).toContain('timeout --kill-after=30s "$DOCKER_PULL_TIMEOUT" docker pull "$image"');
expect(script).toContain('timeout "$DOCKER_PULL_TIMEOUT" docker pull "$image"');
expect(script).toContain('run_docker_pull "$IMAGE_NAME"');
expect(script).not.toContain('docker pull "$IMAGE_NAME"');
@@ -138,6 +140,8 @@ describe("test-install-sh-docker", () => {
'PODMAN_PULL_TIMEOUT="${OPENCLAW_PODMAN_SETUP_PULL_TIMEOUT:-600s}"',
);
expect(script).toContain("run_podman_pull()");
expect(script).toContain("timeout --kill-after=1s 1s true");
expect(script).toContain('timeout --kill-after=30s "$PODMAN_PULL_TIMEOUT" podman pull "$image"');
expect(script).toContain('timeout "$PODMAN_PULL_TIMEOUT" podman pull "$image"');
expect(script).toContain('run_podman_pull "$OPENCLAW_IMAGE"');
expect(script).not.toContain('podman pull "$OPENCLAW_IMAGE"');