refactor(pipelock): move PIPELOCK_IMAGE and PIPELOCK_PORT to docker/pipelock.py
test / run tests/run_tests.py (pull_request) Successful in 14s

Both constants were already only used by Docker-specific code (the
sidecar boot, the proxy_url/host_port naming helpers, the image
contract test). Move them next to DockerPipelockProxy.

Top-level pipelock.py drops the 'os' import along with the constants;
the two test files that pulled PIPELOCK_IMAGE retarget at the new
location.
This commit is contained in:
2026-05-11 13:59:43 -04:00
parent b49281800a
commit 1b3254bf37
4 changed files with 17 additions and 19 deletions
+12 -5
View File
@@ -4,16 +4,23 @@ YAML-config generation from PipelockProxy."""
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
from ...log import die, info, warn from ...log import die, info, warn
from ...pipelock import ( from ...pipelock import PipelockProxy, PipelockProxyPlan
PIPELOCK_IMAGE,
PIPELOCK_PORT,
PipelockProxy, # Pipelock image, pinned by digest. The digest is the multi-arch image
PipelockProxyPlan, # index for ghcr.io/luckypipewrench/pipelock:2.3.0.
PIPELOCK_IMAGE = os.environ.get(
"CLAUDE_BOTTLE_PIPELOCK_IMAGE",
"ghcr.io/luckypipewrench/pipelock@sha256:3b1a39417b98406ddc5dc2d8fcb42865ddc0c68a43d355db55f0f8cb06bc6de9",
) )
# Listening port for pipelock's forward proxy.
PIPELOCK_PORT = os.environ.get("CLAUDE_BOTTLE_PIPELOCK_PORT", "8888")
def pipelock_container_name(slug: str) -> str: def pipelock_container_name(slug: str) -> str:
return f"claude-bottle-pipelock-{slug}" return f"claude-bottle-pipelock-{slug}"
-11
View File
@@ -12,7 +12,6 @@ Image pin: ghcr.io/luckypipewrench/pipelock@sha256:<digest> for tag 2.3.0.
from __future__ import annotations from __future__ import annotations
import os
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
@@ -20,16 +19,6 @@ from pathlib import Path
from .manifest import Bottle, Manifest from .manifest import Bottle, Manifest
from .util import is_ipv4_literal from .util import is_ipv4_literal
# Pipelock image, pinned by digest. The digest is the multi-arch image
# index for ghcr.io/luckypipewrench/pipelock:2.3.0.
PIPELOCK_IMAGE = os.environ.get(
"CLAUDE_BOTTLE_PIPELOCK_IMAGE",
"ghcr.io/luckypipewrench/pipelock@sha256:3b1a39417b98406ddc5dc2d8fcb42865ddc0c68a43d355db55f0f8cb06bc6de9",
)
# Listening port for pipelock's forward proxy.
PIPELOCK_PORT = os.environ.get("CLAUDE_BOTTLE_PIPELOCK_PORT", "8888")
# Baked-in default allowlist for hosts Claude Code itself needs. # Baked-in default allowlist for hosts Claude Code itself needs.
DEFAULT_ALLOWLIST: tuple[str, ...] = ( DEFAULT_ALLOWLIST: tuple[str, ...] = (
"api.anthropic.com", "api.anthropic.com",
+1 -1
View File
@@ -5,7 +5,7 @@ docker."""
import subprocess import subprocess
import unittest import unittest
from claude_bottle.pipelock import PIPELOCK_IMAGE from claude_bottle.backend.docker.pipelock import PIPELOCK_IMAGE
from tests._docker import skip_unless_docker from tests._docker import skip_unless_docker
+4 -2
View File
@@ -12,8 +12,10 @@ import unittest
import urllib.request import urllib.request
from pathlib import Path from pathlib import Path
from claude_bottle.backend.docker.pipelock import DockerPipelockProxy from claude_bottle.backend.docker.pipelock import (
from claude_bottle.pipelock import PIPELOCK_IMAGE PIPELOCK_IMAGE,
DockerPipelockProxy,
)
from tests._docker import skip_unless_docker from tests._docker import skip_unless_docker
from tests.fixtures import fixture_minimal from tests.fixtures import fixture_minimal