mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(setup): kill timed image pulls when supported
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"');
|
||||
|
||||
Reference in New Issue
Block a user