Skip to content

Commit

Permalink
Stop hardcoding the default Docker version (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Feb 8, 2024
1 parent 822b289 commit 1705d83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions shub/image/utils.py
Expand Up @@ -22,7 +22,6 @@
from importlib import metadata


DEFAULT_DOCKER_API_VERSION = '1.21'
STATUS_FILE_LOCATION = '.releases'
_VALIDSPIDERNAME = re.compile('^[a-z0-9][-._a-z0-9]+$', re.I)

Expand All @@ -39,10 +38,10 @@
docker version
and check its output: it should contain Docker client and server versions and
should not contain any errors. The minimum API Version is: {}
should not contain any errors.
You can learn about Docker at https://www.docker.com/.
""".format(DEFAULT_DOCKER_API_VERSION)
"""


def is_verbose():
Expand Down Expand Up @@ -103,7 +102,7 @@ def get_docker_client(validate=True):
verify=apply_path_fun('ca.pem'),
assert_hostname=False)
docker_host = docker_host.replace('tcp://', 'https://')
version = os.environ.get('DOCKER_API_VERSION', DEFAULT_DOCKER_API_VERSION)
version = os.environ.get('DOCKER_API_VERSION', 'auto')

# If it returns an error, check if you have the old docker-py installed
# together with the new docker lib, and uninstall docker-py.
Expand Down
4 changes: 1 addition & 3 deletions tests/image/test_utils.py
Expand Up @@ -15,7 +15,6 @@
load_status_url,
store_status_url,
STATUS_FILE_LOCATION,
DEFAULT_DOCKER_API_VERSION,
)

from .utils import FakeProjectDirectory, add_sh_fake_config
Expand Down Expand Up @@ -44,8 +43,7 @@ def version(self):

mocked_docker.APIClient = DockerClientMock
assert get_docker_client()
client_mock.assert_called_with(
base_url=None, tls=None, version=DEFAULT_DOCKER_API_VERSION)
client_mock.assert_called_with(base_url=None, tls=None, version='auto')
# set basic test environment
os.environ['DOCKER_HOST'] = 'http://127.0.0.1'
os.environ['DOCKER_API_VERSION'] = '1.40'
Expand Down

0 comments on commit 1705d83

Please sign in to comment.